search for: any_arg

Displaying 6 results from an estimated 6 matches for "any_arg".

Did you mean: any_args
2007 Aug 23
6
controller spec with model that validates_uniqueness
I want to use mocks and stubs to test the controller, but am having trouble getting my validation not to trigger. Here''s the code: # spec: Image.stub!(:find).and_return(@image) @image.should_receive(:save!).once.with(:any_args) put :update, :id => @image.id, :category_id => @category.id, :image => {:name => ''test'', :image_number => 13554} #model validates_presence_of :name validates_uniqueness_of :name, :allow_nil => true # rspec output ActiveRecord::RecordInvalid in...
2008 Jun 12
1
how do I mock the Rails Logger with should_receive?
...r for #{path}: #{error}") and return rescue StandardError => error $logger.error("#{self.name} Error for #{path}: #{error}") and return end ... my failed attempt to spec: logger = mock_model(Logger) logger.stub(:error) logger.should_receive(:error).with(:any_args) Do you know of any solution for mocking this? Also, do you think the Rails Logger is worth mocking? Thanks very much in Advance, John -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080612/98720e...
2008 Jun 12
1
Does anyone know how to mock the Rails Logger then set expectations with should_receive?
...r for #{path}: #{error}") and return rescue StandardError => error $logger.error("#{self.name} Error for #{path}: #{error}") and return end ... my failed attempt to spec: logger = mock_model(Logger) logger.stub(:error) logger.should_receive(:error).with(:any_args) Do you know of any solution for mocking this? Also, do you think the Rails Logger is worth mocking? Thanks very much in Advance, -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080612/841a230f/att...
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 Jun 15
6
problem getting started with stubbing in rails controller specs
Hello, Ingo! I''m copying your question to a new e-mail instead of replying to try to keep message threads separate. Have you tried setting up your expectation before issuing the get statement? For example, take this out of the setup block: get ''index'', :locale => ''en'' and move it after:
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: