On Oct 15, 2008, at 4:31 PM, Nick Hoffman wrote:
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?
Just hide the constant behind a method, something like this:
class A
def something; "foo :#{bar}"; end
def bar; B::BAR; end
end
This allows you to stub the constant, if need be.
Scott
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users