search for: should_raise

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

2008 Feb 13
5
Example controller spec no worky?
...e.should render_template("#{RAILS_ROOT}/public/404.html") response.response_code.should == 404 end #end spec Because I''m stubbing find does that mean the RecordNotFound exception doesn''t happen and thus the 404 doesn''t render? I tried stubbing and using should_raise, and_raise, whatever the heck it is, but I just don''t get it, nothing seems to work. It behaves as expected when browser tested! :O I''m going to spontaneously combust! [RSpec 1.1.2, Rails 2.0.2, ZenTest 3.8.0] -- Posted via http://www.ruby-forum.com/.
2009 May 02
10
Problem verifying routing error
...ing to rspec/rspec-rails 1.2.6 gem (from 1.1.12), I''m having a new problem verifying routes that should not exist. This is to support something like this in routes.rb: map.resources :orders do |orders| orders.resources :items, :except => [:index,:show] end I used to use lambda {}.should_raise( routing error ), but it stopped detecting any raised error. Requesting it through the browser produces ActionController::MethodNotAllowed (Only post requests are allowed). But that error wasn''t detected. When I skip the lambda, and just ask it to verify that the route does exist (which...
2007 Feb 05
1
long jumping out of code in specs
...l the calls it gets. In my case calling RssParser.new is evidence enough that my code executed like it should. class SpecShortcut < Exception; end specify "should call the standard parsing methods" do RssParser.should_receive(:new).and_raise(SpecShortcut) lambda{do_action}.should_raise(SpecShortcut) end Feeling pain like this while writing specs is usally an indication that the code could be better designed. But I don''t see how else one could spec ActiveRecord''s after_create hook, without going through with mocking and stubbing all the code the after_create h...
2006 Oct 24
2
1 should be 2. huh?
There''s another quirk I wanted to bring up. It''s about the failure message with should_equal and should_be. x.should_equal 2 a.should_not_be nil When they fail they yield messages like: 1 should equal 2 nil should not be nil When I''m caught off guard, which can be often, these messages confuse me. 1 should equal 2? No it shouldn''t. nil should not be
2007 Apr 04
11
ANN: RSpec 0.9.0 beta-1 available for download.
We''d like to get some feedback on RSpec 0.9 before we start pushing out releases via Rubyforge''s gem server and update the website. We have therefore made the first beta of 0.9 available - both prepackaged and tagged in subversion (see below). RSpec 0.9 introduces a new API for expectations, which essentially means that your underscores go away (there has been other discussions
2007 Jul 26
5
Coding standards and whitespace
...e.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_receive.tmSnippet RSpec.tmbundle/Snippets/should_receive_with_any_args.tmSnippet RSpec.tmbundle/Snippets/should_receive_with_args.tmSnippet RSpec.tmbundle/Snippets/should_receive_with_no_args.tmSnippet RSpec.tmbundle/Snippets/should_redirect_to.tmSnippet RSp...