search for: stubbee

Displaying 7 results from an estimated 7 matches for "stubbee".

Did you mean: stubbed
2007 Apr 11
0
Fwd: [ mocha-Feature Requests-5856 ] Stubbing of private methods should be allowed
...x: lib/stubba/instance_method.rb =================================================================== --- lib/stubba/instance_method.rb (revision 57) +++ lib/stubba/instance_method.rb (working copy) @@ -13,8 +13,9 @@ # intentionally empty end - def exists? - stubbee.respond_to?(method) + def exists? + #stubbee.respond_to?(method) + (stubbee.methods | stubbee.private_methods).include?(method.to_s) end end ---------------------------------------------------------------------- >Comment By: James Mead (jamesmead) Date: 2007-04-11...
2009 Jun 13
2
removing Mocha; 'spec spec' fails but the specific model file passes
...(questions)$ spec spec ...................................c:/work/quizmaker_demo/spec/models/ user_spec.rb:86 User.authenticate(''nonexisting'', ''secret'').should be_nil (rdb:1) s c:/tools/ruby/ruby186/lib/ruby/gems/1.8/gems/mocha-0.9.5/lib/mocha/ class_method.rb:40 stubbee.__metaclass__.class_eval("def #{method}(*args, &block); mocha.method_missing(:#{method}, *a (rdb:1) c
2007 Jan 11
4
counter-intuitive behaveour when passing a proc to Mocha::Expectation#returns
...eturns( lambda { eval "len" } ) Unfortunately this doesn''t work, since the "stubs" method doesn''t at all take parameter names into account. As far as I can see, this is the place where the actual method replacement is being done: def define_new_method stubbee.metaclass.class_eval "def #{method}(*args, &block) mocha.method_missing(:#{method}, *args, &block); end" end and it just passes all the arguments as an array. I''m not suggesting the fix for the problem at hand is trivial - I can''t see at a glance how one...
2007 Mar 30
7
problem with using any_instance
Hey all, I have a question with using mocha in my tests. In the same test file, I have two tests, <code> def test_a klass.any_instance.stubs(:method_name).returns("something") klass.new.method_name ... end def test_b ... klass.new.method_name ... end </code> where klass is some class when the tests run, test _a passes, but test_b had an error like this:
2007 Jan 17
8
Mocha Mock''s hanging on after test run?
Hi guys, I''m running mocha (0.3.2) against Rails core and just found an issue where the mock doesn''t go away after the test is run. For example: def test_reset_bang_doesn_reinstall_named_routes ActionController::Routing::Routes.named_routes.expects(:install).never @session.reset! end def test_zzz puts ActionController::Routing::Routes.named_routes.inspect
2007 Sep 06
1
any reason we can''t use the concise stubs on Object
...} Why can''t we do it on ''real'' objects? >> foo = Object.new >> foo.stubs(:method1 => ''a'', :method2 => ''b'') TypeError: #<Mocha::InstanceMethod:0x32f9100 @method={:foo=>"b", :again=>"hi"}, @stubbee=#<Object:0x32fc364>> is not a symbol from /opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.4/lib/mocha/mock.rb:148:in `method_defined?'' from /opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.4/lib/mocha/mock.rb:148:in `add_expectation'' from /opt/local/lib/rub...
2007 Aug 08
1
Mocking Time, delegating to original object
...tes @return_values += ReturnValues.new(Delegator.new(self)) end alias :stops_mocking :delegates alias :stops_stubbing :delegates end class Delegator def initialize expectation @expectation = expectation end def evaluate @expectation.mock.stub_method.stubbee.send(@expectation.mock.stub_method.hidden_method) end end end class Object def expects(symbol) method = stubba_method.new(stubba_object, symbol) $stubba.stub(method) mocha.expects(symbol, caller, method) end def stubs(symbol) method = stubba_method.new(stubba_object,...