I would like to ask for Your experience how to handle mocking class
method only for one specific test.

Scenario is:
I have unit test suite and in one of the test I have mocked a class
method, and I want this class method to be only mocked in this
specific test.
But this mock applies to all test files while I run rake test:units.

I thought about doing like this with setup and teardown:

class SomeTest < ...

def setup
  #here ovveride class method body in runtime
end

def teardown
  #and here bring back class method body in runtime
end

end

But I'm not sure if this is the way it should be done ?

And the reason why I need to do it this way is because in some
particular tests I need to mock the class method and in other i don't.
In my case it is about calls to sandbox. In some tests I check if they
are made correctly and in other I test only logic flow and I don't
want to make real calls to sandbox.

Thanks for any ideas.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to