search for: mock_time

Displaying 2 results from an estimated 2 matches for "mock_time".

Did you mean: lock_time
2006 Dec 21
1
need some guidance with a test
This is part of a rails project. The following method is part of the Ams class (a rails model). I''m a bit unsure of the rspec/bdd way of testing this method. def persist_as_domains @current_domains.each do |d| dom = Domain.new dom.domain = d dom.source_id = 1 dom.at = Time.now dom.save end end The following is what came out when I tried to write my test. Notice
2007 Aug 08
1
Mocking Time, delegating to original object
...od = stubba_method.new(stubba_object, symbol) $stubba.stub(method) mocha.stubs(symbol, caller, method) end end Haven''t tested this with anything other than Time.now, but thought I''d solicit the general opinion about this behavior. Usage is: Time.expects(:now).returns(mock_time).then.stops_mocking