search for: raise_controller_error

Displaying 5 results from an estimated 5 matches for "raise_controller_error".

2007 Jul 09
12
Mocking User.find( :all, :limit => 10 )
Hi, I''m trying to setup a mock for my controller test but I can''t get it to recognise the mock. I use it "should find all users" do User.should_receive(:find).with( :all, :limit => 10 ).and_return([@user]) do_get end and in the controller @users = User.find(:all, :limit => 10 ) But this does not work. It gives me User expected :find with (:all)
2007 May 23
8
Rails Rendering diagnostics.rhtml in Controller Spec
Forgive me if this isn''t the proper list. It''s specific to the rSpec Rails plugin. The problem is, some controller actions are rendering the "diagnostics.rhtml" template when I''m expecting it to render something else in a controller spec. I''m assuming this is the template that displays the error message and a stack trace when an error is raised in the
2007 Oct 07
0
Is there a way to use the rescue_action defined in a controller in the controller''s specs?
...exceptions with a defined class. For example if a login fails for some reason I just have to throw a certain error, this will get rescued by a special method which then redirects back to the login page. This works fine if you run it, but seems really hard to spec. I did a lot of search and found a raise_controller_errors method in RSpec before 1.0.6 but even if it would be still available it seems not be a cool solution, because I would not like to spec the exception, I would like to spec the redirect and that seems impossible at the moment. All I get is the render of the diagnostic.html if I leave RSpec in it...
2007 Jun 21
0
Testing a Rails plugin
...ire ''spec/rails'' Spec::Runner.configure do |config| config.use_transactional_fixtures = true config.use_instantiated_fixtures = false config.fixture_path = File.dirname(__FILE__) + "/fixtures/" config.before(:each, :behaviour_type => :controller) do raise_controller_errors end end -------------- It all seems to be working, but I haven''t kicked the tires to hard yet. Just thought I''d run this setup by you for comments. Tom
2007 May 31
16
Could anyone please help with rspec/nested resource behavior checking?
My problem has been listed here: http://railsforum.com/viewtopic.php?pid=25439#p25439 Don''t think it would be required to completely re-type it here :) Thanks! -- -Daniel Fischer http://danielfischer.com - Geek Blog http://abigfisch.com - Portfolio http://writersbeat.com - Writing Community