diff options
author | Francis Irving <francis@mysociety.org> | 2009-12-02 17:51:30 +0000 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2009-12-02 17:51:30 +0000 |
commit | 5f3139b538d1ff58b719a72d7c7cf05a5b6136b5 (patch) | |
tree | 13597cf6751df3122bfb1f1e5b1699e5c7ec5f93 /vendor/plugins/rspec-rails/Upgrade.rdoc | |
parent | dcf788cab6268a5c9830178d1bdff606f84132ce (diff) |
Part of upgrade to rails 2.3.2
Diffstat (limited to 'vendor/plugins/rspec-rails/Upgrade.rdoc')
-rw-r--r-- | vendor/plugins/rspec-rails/Upgrade.rdoc | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/vendor/plugins/rspec-rails/Upgrade.rdoc b/vendor/plugins/rspec-rails/Upgrade.rdoc new file mode 100644 index 000000000..ba7d02c3b --- /dev/null +++ b/vendor/plugins/rspec-rails/Upgrade.rdoc @@ -0,0 +1,148 @@ += Upgrade to 1.2.8 (in git) + +== What's new + +=== route_to and be_routable matchers + +Stop using route_for and params_from today! These new matchers from Randy +Harmon are more expressive and more reliable. Here's how you use them: + + { :put => "/projects/37" }.should route_to(:controller => 'projects', :action => 'update', :id => '37') + + { :get => "/nonexisting_route" }.should_not be_routable + +== What's changed + +=== spec_server has been removed + +spec_server was deprecated in 1.2.7 and has now been removed. Admittedly, this +was a short deprecation cycle, but spec server never quite worked right in all +situations and spork is a great solution that you can use today! This is all +you need to do: + + [sudo] gem install spork + cd path/to/project + spork --bootsrap + +Now open up spec/spec_helper.rb and follow the directions at the top. You'll +be up and running in no time. + +For more info: + +* http://github.com/timcharper/spork +* http://groups.google.com/group/sporkgem + += Upgrade to 1.2.7 + +== What's changed + +=== spec_server is deprecated + +spec_server is deprecated in favor of Tim Harper's new spork library +(http://github.com/timcharper/spork). Get it. Use it. Love it. + + gem install spork + += Upgrade to 1.2.0-1.2.6 + +== What's changed + +=== Supported Rails Versions + +This release supports the following versions of rails: + +* 2.0.5 +* 2.1.2 +* 2.2.2 +* 2.3.2 + +=== update generated files + +Be sure to run "script/generate rspec" and allow the following files to be overwritten: + +* lib/tasks/rspec.rake +* script/spec +* script/spec_server + +=== controller.use_rails_error_handling! is deprecated + +Use <tt>rescue_action_in_public!</tt> instead. It comes directly from rails and does +exactly the same thing + +=== route_for + +After a change to edge rails broke our monkey-patched <tt>route_for</tt> method, I +decided to just delegate to rails' <tt>assert_generates</tt> method. For most cases, +this will not present a problem, but for some it might. You'll know if you +upgrade and see any newly failing, route-related examples. Here are the things +that you might need to change. + +==== Make sure IDs are strings + +If you had :id => 1 before, you need to change that to :id => "1" + + #old + route_for(:controller => 'things', :action => 'show', :id => 1).should == "/things/1" + + #new + route_for(:controller => 'things', :action => 'show', :id => "1").should == "/things/1" + +==== Convert paths for non-get methods to hashes + +If you had an example with a route that requires post, put, or delete, you'll +need to declare that explicitly. + + #old + route_for(:controller => 'things', :action => 'create').should == "/things" + + #new + route_for(:controller => 'things', :action => 'create').should == {:path => "/things", :method => :post} + +=== Controller/template isolation + +Even though controller specs do not render views by default (use +<tt>integrate_views</tt> to get them to render views), the way this works has +changed in this version. + +It used to be that the view template need not even exist, but due to changes +in rails it became much more difficult to manage that for all the different +versions of rails that rspec-rails supports. So now the template must exist, +but it still won't be rendered unless you declare <tt>integrate_views</tt>. + +== What's new + +=== render no longer requires a path + +The <tt>render()</tt> method in view specs will infer the path from the +first argument passed to <tt>describe()</tt>. + + describe "players/show" do + it "does something" do + render + response.should have_tag("....") + end + end + +=== routing specs live in spec/routing + +<tt>script/generate rspec_scaffold</tt> now generates its routing spec in +<tt>spec/routing/</tt>. + +=== bypass_rescue + +Added a new <tt>bypass_rescue()</tt> declaration for controller specs. Use this +when you want to specify that an error is raised by an action, even if that +error is later captured by a <tt>rescue_from()</tt> declaration. + + describe AccountController do + describe "GET @account" do + context "requested by anonymous user" do + it "denies access" do + bypass_rescue + lambda do + get :show, :id => "37" + end.should raise_error(AccessDenied) + end + end + end + end |