[rspec-users] accessing constants from another module within examples

Jarmo Pertman jarmo.p at gmail.com
Wed Jun 16 10:36:27 EDT 2010


Why do you think that it's not working in regular Ruby either?

Check the following example to see that it does:
module MyModule
  MyConstant = 1
  def my_method
    2
  end
end

class MyClass
  include MyModule

  def initialize
    p my_method
    p MyModule::MyConstant
    p MyConstant
  end
end

MyClass.new

Jarmo

On Jun 16, 5:20 pm, Matt Wynne <m... at mattwynne.net> wrote:
> That wouldn't work in regular ruby either. You need to run the describe block inside the module / namespace.


More information about the rspec-users mailing list