[rspec-users] How to spec accessing a constant

Nick Hoffman nick at deadorange.com
Wed Oct 15 16:31:37 EDT 2008


Hi guys. One of my methods uses a constant in another method, like this:

class A
     def something
         "foo: #{B::BAR}"
     end
end

When writing the spec for A#something , how would you mock or stub  
#{B::BAR}, and how would you set an expectation that B::BAR is used?

Thanks,
Nick


More information about the rspec-users mailing list