search for: no_arg

Displaying 10 results from an estimated 10 matches for "no_arg".

Did you mean: no_args
2008 Mar 05
7
mocking successive return values
...ookup 3 existing quote numbers, append nil to the end (for a total of 4) ## The test it "should not generate a duplicate quote number" do existing_quote_numbers = Policy.find(:all).map{|p| p.quote_number} [0,3] @policy_service .should_receive (:random_string ).with (:no_args ).exactly(4).times.and_return(existing_quote_numbers.concat([nil])) @policy_service.generate_quote_number end ## The result should not generate a duplicate quote number Mock ''Service::Base'' expected :random_string with (no args) 4 times, but received it once I verif...
2007 Jun 11
2
Testing create in Rails controller
...;description" => ''Really cool wireless keyboard'', "image_url" => ''a.gif'', "price" => 1.00} Product.should_receive(:new).with(attributes) Product.should_receive(:save).with(:no_arg) post :create, :product => attributes end end Which I copied and modified from the example. The code in the controller looks like: def create @product = Product.new(params[:product]) if @product.save flash[:notice] = ''Product was successfully created....
2007 Nov 18
9
Not sure why this is failing
I am not sure why the tests don''t see the call of the new method for the Address class. It can be seen in the controller method where the Address.new is called. >> @address = Address.new(params[:address]) What am I doing wrong? Thanks for the help. Here is the error message: Spec::Mocks::MockExpectationError in ''UsersController handling POST /users should create a new
2007 Sep 25
12
Problems with expect_render
Hi there, I''ve been working with RSpec for about a week now, and the process of moving from a Test::Unit + Mocha setup to an RSpec + Mocha environment has been pretty straightforward. Except, I''m having problems with using template.expect_render. I have Mocha enabled with: > config.mock_with :mocha in spec_helper. And then I have a view spec which looks like this:
2007 Jun 09
11
authentication, controller specs. I think I''m missing something simple ....
...t this point, a "rake spec" works just fine. All specs pass. I add in the "include AuthenticatedSystem" in the ThingsController and add a line to the "before" section in each of the describe stanzas that reads: controller.should_receive(:login_required).with(no_args).once.and_return(true) All tests pass just fine at this point as well. It''s this next part where I get really confused about how the spec should be written. What I change in the controller itself (and at this point, all methods are the default generated by the scaffold) is to add scopi...
2004 Mar 19
1
Case insensitive user names
I am trying to set up the Dovecot pop3 server for some virtual hosting I am doing and it is going well, I am generating a passwd file that points dovecot to the virtual users mailspool. The only thing that I don't have working is that my current pop3 server (NTMail) has case insensitve usernames. Dovecot doesn't. I was hoping there was just an option to turn on, but I didn't see
2007 Jan 29
3
Bug in should_not_be - What else to use?
Hi! I just stumbled over a possible bug in 0.7.5.1: `1.should_not_be == 1` does not fail. I took a look into the code and figured out, that this is caused by Not.be() using :no_arg instead of :___no_arg. The expected argument of the method be() in Not is passed from should_not_be() with :___no_arg. Not.be() is marked with "Gone for 0.9", so I assume that "should_not_be ==" shouldn''t be used at all, right? So what else to use, when testing of &quo...
2006 Dec 21
3
Speccing private class methods
Hi How can I specify that a private method of a class gets called? If you run the code below, only spec (1) passes. Spec (2) is what I found causing problems in my code, and class (3) is my failed attempt to work around it. (3 really puzzles me - why is a private class method not accessible via send?) Another problem is that stub! makes public methods, which changes the behaviour of
2007 Apr 17
8
problem with rspec_on_rails and @controller.should_receive(:render) in trunk
Hey guys! I am using rspec trunk, and I am having a little problem with the latest version. (I am quite sure this worked with an older version about a week ago) heres the spec: it "should render the new user form without layout for a xhr request" do @controller.should_receive(:render).with(:layout=>false) xhr :get,:new end and the controller: def new render
2007 Dec 13
16
"Tricks" for testing after_create callback???
I''ve got a model Message, which needs to send an email using action mailer after it''s first saved in the database. I want to pass the model to the mailer which then uses methods on the message model to render the email. So the natural way to do this is in an after_create callback on the Message model. But I can''t see an easy way to test this. Here''s my spec