psyho / bogus

Fake library for Ruby
Other
359 stars 14 forks source link

Implement fake_const(SomeConst) #46

Open wrozka opened 10 years ago

wrozka commented 10 years ago

Let's assume that in the production code there is a constant defined like this:

UserValidator = Validator.new do
  # ...
end

We want to be able to fake this object (copy it's entire interface):

fake(:user_validator, as: :object)

and we want to be able to replace the constant with a fake object that has the same exact interface:

fake_const(UserValidator)