Skip to content
Newer
Older
100644 57 lines (39 sloc) 1.56 KB
8bb3cd5 @dchelimsky add Upgrade notes for relish site
dchelimsky authored Dec 22, 2010
1 # Upgrading from rspec-rails-1.x to rspec-rails-2.
2
3 This is a work in progress. Please submit errata, missing steps, or patches to
4 the [rspec-rails issue tracker](https://github.com/rspec/rspec-rails/issues).
5
6 ## Rake tasks
7
8 Delete lib/tasks/rspec.rake, if present. Rake tasks now live in the rspec-rails
9 gem.
10
11 ## `spec_helper.rb`
12
13 There were a few changes to the generated `spec/spec_helper.rb` file. We
14 recommend the following:
15
16 1. set aside a copy of your existing `spec/spec_helper.rb` file.
17 2. run `rails generate spec:install`
18 3. copy any customizations from your old spec_helper to the new one
19
20 If you prefer to make the changes manually in the existing spec_helper, here
21 is what you need to change:
22
23 # rspec-1
24 require 'spec/autorun'
25
26 Spec::Runner.configure do |config|
27 ...
28 end
29
30 # rspec-2
31 require 'rspec/core'
32
33 RSpec.configure do |config|
34 ...
35 end
36
37 ## Controller specs
38
39 ### `response.should render_template`
40
41 This needs to move from before the action to after. For example:
42
43 # rspec-rails-1
44 controller.should render_template("edit")
45 get :edit, :id => "37"
46
47 # rspec-rails-2
48 get :edit, :id => "37"
49 response.should render_template("edit")
50
51 rspec-1 had to monkey patch Rails to get render_template to work before the
52 action, and this broke a couple of times with Rails releases (requiring urgent
53 fix releases in RSpec). Part of the philosophy of rspec-rails-2 is to rely on
54 public APIs in Rails as much as possible. In this case, `render_template`
55 delegates directly to Rails' `assert_template`, which only works after the
56 action.
Something went wrong with that request. Please try again.