search for: should_not_receive

Displaying 12 results from an estimated 12 matches for "should_not_receive".

2006 Dec 15
3
Partial mock when a complex return value is required
...going on here that relies on stuff produced from the above loop ... end end And here is the offending spec: specify "should prefetch the future residuals" do TODO: ask rspec team about duplicating this logic to get a nice error message @derivatives_by_id[26149].should_not_receive (:cap_future_residuals_for_registration_date).and_return( CapFutureResidual.find_all_by_derivative_id_and_registration_year_and_re gistration_month(26149, 2003, 9) ) end Sorry for the car finance jargon!!! How can I get round this? Here is my attempt at an alternative spec -...
2008 Jun 07
3
Match render :nothing
Hello guys, Is there any way to match a render :nothing? I coudn''t find any way to do this so i''ve just changed my controllers to do a "head :ok", but it would be nice to know if there is any other way :) -- Maur?cio Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) Jo?o Pessoa, PB, +55 83 8867-7208
2006 Jul 24
6
Mocking causes empty specification blocks
I''ve found myself mocking out a published api in my set-up method. This has led to some contexts having a large set-up and empty specifications. As the mocks get auto-verified, the specification blocks have nothing to do but serve as documentation. Does this sound bad? Chris
2007 Dec 06
6
mock libraries, Object#send, and Object#__send__
What is the appropriate way to stub out (and put an expectation on Object#__send__), without getting warnings from the Rspec mock library? Scott
2007 Jan 25
0
mocking methods that receive blocks - back to mocking Thread again
...end end end context "The TaskRunner" do setup do @runner = TaskRunner.new @task = mock(''SampleTask'') @task.stub!(:run) Thread.stub!(:new) end specify "should not run a task in the main thread" do @task.should_not_receive(:run) @runner.execute(@task) end specify "should run a task in a new thread" do Thread.should_receive(:new).with(@task).and_yield(@task) @task.should_receive(:run) @runner.execute(@task) end specify "should be running while a task...
2012 May 05
1
rspec-mocks and rspec-rails-2.10.1 are released!
...l changelog: http://github.com/rspec/rspec-mocks/compare/v2.10.0...v2.10.1 Bug fixes * fix [regression of edge case behavior](https://github.com/rspec/rspec-mocks/issues/132) * fixed failure of `object.should_receive(:message).at_least(0).times.and_return value` * fixed failure of `object.should_not_receive(:message).and_return value` ### rspec-rails-2.10.1 full changelog: http://github.com/rspec/rspec-rails/compare/v2.10.0...v2.10.1 Bug fixes * fix [regression introduced in 2.10.0 that broke integration with Devise](https://github.com/rspec/rspec-rails/issues/534)
2007 Feb 20
6
How to spec code with multiple (interacting) paths
...email) @db_updater = mock("db_updater"); @db_updater.stub! (:update_db) @data_storer = DataStorer.new(@logger, @emailer, @db_updater, false) end specify "should NOT store the data given to the DB when asked to store" do @db_updater.should_not_receive(:update_db) @data_storer.store("moo") end end I have a bad feeling about this. If I change the emailer line in the store method to this: @emailer.send_email("Somebody stored ''#{data}''") if @do_update_db_step The behaviour has ch...
2008 Jun 28
19
Stopping example execution?
Hello, I''m wondering If I am missing something here when creating an example that sets an expecation at the top or beginning of an action but requires you to stub / mock everything that follows. Example: I want to test that a certain controller is running a before_filter...thats easy: - controller.should_receive(:require_user) - do_get But now i''ve got to mock / stub
2006 Oct 04
3
do we need stubbing?
Hey all - The trunk currently supports three types of mocking/stubbing: Mock Objects (created dynamically at runtime) Partial Mocking of methods on existing classes Stubbing of methods on existing objects or classes The main difference between Partial Mocking and Stubbing is that Stubs don''t verify. I''m wondering if we really need the stubbing facility at all, given that we
2006 Oct 23
6
overriding mock expectations
There is one annoyance I''m encountering with the Mock API in rSpec. Overall it works well, as far as dynamic mocks go ;)... but there''s this one thing... It doesn''t allow overriding of expectations. example: m = mock("blah") m.should_receive(:one).any_number_of_times().and_return(1) m.should_receive(:one).and_return(1) The second call to should_receive
2007 Feb 02
7
Coming Soon...
...inking RSpec''s implementation or commit to a future of monkey patching other frameworks as they introduce new uses of method_missing. Using expectation matchers means that we only need to add 4 methods to Object: #for expectation matchers should should_not #for mocks/stubs should_receive should_not_receive So it is much less invasive than it was before and, because we are not using method_missing on YOUR objects, is much less conflict/error prone. It also supports a clear entry point to writing custom expectation matchers, so if you have some domain-specific expectations like "should travel_mo...
2007 Jul 26
5
Coding standards and whitespace
...rect.tmSnippet RSpec.tmbundle/Snippets/should_not_equal.tmSnippet RSpec.tmbundle/Snippets/should_not_include.tmSnippet RSpec.tmbundle/Snippets/should_not_match.tmSnippet RSpec.tmbundle/Snippets/should_not_predicate.tmSnippet RSpec.tmbundle/Snippets/should_not_raise.tmSnippet RSpec.tmbundle/Snippets/should_not_receive.tmSnippet RSpec.tmbundle/Snippets/should_not_respond_to.tmSnippet RSpec.tmbundle/Snippets/should_not_satisfy.tmSnippet RSpec.tmbundle/Snippets/should_not_throw.tmSnippet RSpec.tmbundle/Snippets/should_predicate.tmSnippet RSpec.tmbundle/Snippets/should_raise.tmSnippet RSpec.tmbundle/Snippets/should_...