rspec-rails 2.14.2 → 2.99.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +14 -6
  2. data/Changelog.md +8 -10
  3. data/features/Autotest.md +24 -0
  4. data/features/Generators.md +24 -0
  5. data/features/GettingStarted.md +84 -0
  6. data/features/README.md +56 -0
  7. data/features/RailsVersions.md +4 -0
  8. data/features/Transactions.md +84 -0
  9. data/features/Upgrade.md +121 -0
  10. data/features/controller_specs/Cookies.md +57 -0
  11. data/features/controller_specs/README.md +45 -0
  12. data/features/controller_specs/anonymous_controller.feature +378 -0
  13. data/features/controller_specs/bypass_rescue.feature +75 -0
  14. data/features/controller_specs/controller_spec.feature +58 -0
  15. data/features/controller_specs/engine_routes.feature +51 -0
  16. data/features/controller_specs/isolation_from_views.feature +87 -0
  17. data/features/controller_specs/render_views.feature +114 -0
  18. data/features/feature_specs/feature_spec.feature +34 -0
  19. data/features/helper_specs/helper_spec.feature +122 -0
  20. data/features/mailer_specs/url_helpers.feature +38 -0
  21. data/features/matchers/README.md +18 -0
  22. data/features/matchers/new_record_matcher.feature +41 -0
  23. data/features/matchers/redirect_to_matcher.feature +40 -0
  24. data/features/matchers/relation_match_array.feature +27 -0
  25. data/features/matchers/render_template_matcher.feature +49 -0
  26. data/features/mocks/mock_model.feature +147 -0
  27. data/features/mocks/stub_model.feature +58 -0
  28. data/features/model_specs/README.md +21 -0
  29. data/features/model_specs/errors_on.feature +51 -0
  30. data/features/model_specs/records.feature +27 -0
  31. data/features/model_specs/transactional_examples.feature +109 -0
  32. data/features/request_specs/request_spec.feature +49 -0
  33. data/features/routing_specs/README.md +16 -0
  34. data/features/routing_specs/be_routable_matcher.feature +80 -0
  35. data/features/routing_specs/engine_routes.feature +38 -0
  36. data/features/routing_specs/named_routes.feature +18 -0
  37. data/features/routing_specs/route_to_matcher.feature +90 -0
  38. data/features/step_definitions/additional_cli_steps.rb +4 -0
  39. data/features/step_definitions/model_steps.rb +3 -0
  40. data/features/support/env.rb +53 -0
  41. data/features/support/rails_versions.rb +4 -0
  42. data/features/support/rubinius.rb +6 -0
  43. data/features/view_specs/inferred_controller_path.feature +45 -0
  44. data/features/view_specs/stub_template.feature +51 -0
  45. data/features/view_specs/view_spec.feature +206 -0
  46. data/lib/autotest/rails_rspec2.rb +81 -76
  47. data/lib/generators/rspec/install/templates/spec/spec_helper.rb.tt +1 -6
  48. data/lib/rspec/rails/adapters.rb +5 -12
  49. data/lib/rspec/rails/example/controller_example_group.rb +1 -2
  50. data/lib/rspec/rails/example/helper_example_group.rb +3 -3
  51. data/lib/rspec/rails/example/view_example_group.rb +4 -7
  52. data/lib/rspec/rails/matchers/have_extension.rb +0 -1
  53. data/lib/rspec/rails/matchers/routing_matchers.rb +0 -4
  54. data/lib/rspec/rails/mocks.rb +0 -26
  55. data/lib/rspec/rails/tasks/rspec.rake +5 -12
  56. data/lib/rspec/rails/version.rb +1 -1
  57. data/spec/autotest/rails_rspec2_spec.rb +36 -0
  58. data/spec/generators/rspec/controller/controller_generator_spec.rb +97 -0
  59. data/spec/generators/rspec/helper/helper_generator_spec.rb +30 -0
  60. data/spec/generators/rspec/install/install_generator_spec.rb +30 -0
  61. data/spec/generators/rspec/integration/integration_generator_spec.rb +44 -0
  62. data/spec/generators/rspec/mailer/mailer_generator_spec.rb +48 -0
  63. data/spec/generators/rspec/model/model_generator_spec.rb +52 -0
  64. data/spec/generators/rspec/observer/observer_generator_spec.rb +21 -0
  65. data/spec/generators/rspec/scaffold/scaffold_generator_spec.rb +138 -0
  66. data/spec/generators/rspec/view/view_generator_spec.rb +41 -0
  67. data/spec/rspec/rails/assertion_adapter_spec.rb +28 -0
  68. data/spec/rspec/rails/assertion_delegator_spec.rb +43 -0
  69. data/spec/rspec/rails/configuration_spec.rb +26 -0
  70. data/spec/rspec/rails/deprecations_spec.rb +18 -0
  71. data/spec/rspec/rails/example/controller_example_group_spec.rb +100 -0
  72. data/spec/rspec/rails/example/feature_example_group_spec.rb +56 -0
  73. data/spec/rspec/rails/example/helper_example_group_spec.rb +66 -0
  74. data/spec/rspec/rails/example/mailer_example_group_spec.rb +21 -0
  75. data/spec/rspec/rails/example/model_example_group_spec.rb +15 -0
  76. data/spec/rspec/rails/example/request_example_group_spec.rb +17 -0
  77. data/spec/rspec/rails/example/routing_example_group_spec.rb +32 -0
  78. data/spec/rspec/rails/example/view_example_group_spec.rb +220 -0
  79. data/spec/rspec/rails/extensions/active_model/errors_on_spec.rb +23 -0
  80. data/spec/rspec/rails/extensions/active_record/base_spec.rb +42 -0
  81. data/spec/rspec/rails/fixture_support_spec.rb +17 -0
  82. data/spec/rspec/rails/matchers/be_a_new_spec.rb +142 -0
  83. data/spec/rspec/rails/matchers/be_new_record_spec.rb +33 -0
  84. data/spec/rspec/rails/matchers/be_routable_spec.rb +41 -0
  85. data/spec/rspec/rails/matchers/be_valid_spec.rb +44 -0
  86. data/spec/rspec/rails/matchers/errors_on_spec.rb +38 -0
  87. data/spec/rspec/rails/matchers/has_spec.rb +29 -0
  88. data/spec/rspec/rails/matchers/have_rendered_spec.rb +93 -0
  89. data/spec/rspec/rails/matchers/redirect_to_spec.rb +80 -0
  90. data/spec/rspec/rails/matchers/relation_match_array_spec.rb +31 -0
  91. data/spec/rspec/rails/matchers/route_to_spec.rb +151 -0
  92. data/spec/rspec/rails/minitest_lifecycle_adapter_spec.rb +22 -0
  93. data/spec/rspec/rails/mocks/mock_model_spec.rb +378 -0
  94. data/spec/rspec/rails/mocks/stub_model_spec.rb +154 -0
  95. data/spec/rspec/rails/setup_and_teardown_adapter_spec.rb +32 -0
  96. data/spec/rspec/rails/view_rendering_spec.rb +111 -0
  97. data/spec/spec_helper.rb +31 -0
  98. data/spec/support/ar_classes.rb +42 -0
  99. data/spec/support/helpers.rb +20 -0
  100. data/spec/support/matchers.rb +9 -0
  101. data/spec/support/null_object.rb +6 -0
  102. metadata +223 -47
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6741d6e7967f02aced3fb72537ba85386350d57f
4
- data.tar.gz: 1afb7b53f425c8d4444fe480212d94ddcade704b
5
- SHA512:
6
- metadata.gz: 76c3968ca67e9054656f0e855f000637458c9318c68b82bdb9965781ebf4073f7ce43a699368a74479dd6db02a75712ac78af7851b73683d062d61acfa2892d9
7
- data.tar.gz: 00c97b1e0c7873f74330710bf1cdca9862f3a174826ec897141624f85949196d678cb12827d18aa67cc773e22b844cedeb39b7fbb04121a1220e62eb7b897084
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzMxYzE1NGZhMDdhYTFkNTc5Y2MyNTU1M2IxMWUyOGY1MzMwZTU5NA==
5
+ data.tar.gz: !binary |-
6
+ ODA5YjFlY2UzYjk0YTNhNTkwMmE2ZTBhMDZjNWU5OGI4NTY3YzFmYQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MWQwNDc3ZjhkNzI2Zjc5YzU1YjJhOWRjMmJhNDJkODQ4YTE4MjBlMzY1YWE2
10
+ YzI5MjQ1ZjJjNDg2MDQyMzA5YTFhMTQ1OTE0ZDllOTYyMjliZmZhOTU2MDI0
11
+ MmQzNGUwNTZjZWM1NGViNzAxOGY4YjgxMTI1OTQ4OTZhN2FlMDk=
12
+ data.tar.gz: !binary |-
13
+ OWM4ZGMwODc0NTRlNDYwNjNmYWQ5MmM3ZTVmMTY3ODVjNjY4M2IzNGI4MTA4
14
+ N2E2MmU2OGE1NDZjYTZhYjU1ZDM1MjAxOTUwMmMxZGY4ODgxMGEwZmQzOGJh
15
+ MTBkZjBlNjYwOWVkN2JiOTFiZjMxNmQ4ODgxYTAyZWEyODkwNzY=
@@ -1,14 +1,14 @@
1
- ### 2.14.2 / 2014-03-22
2
- [full changelog](http://github.com/rspec/rspec-rails/compare/v2.14.1...v2.14.2)
1
+ ### 2.99.0.beta1 / 2013-11-07
2
+ [full changelog](http://github.com/rspec/rspec-rails/compare/v2.14.0...v2.99.0.beta1)
3
3
 
4
- Bug fixes
4
+ Deprecations
5
+
6
+ * Deprecates autotest integration in favor of the `rspec-autotest` gem. (Andy
7
+ Lindeman)
5
8
 
6
- * Loads ActiveSupport properly to support changes in Rails 4.1. (Andy Lindeman)
7
- * Anonymous controllers inherit from `ActionController::Base` if `ApplicationController`
8
- is not present. (Jon Rowe)
9
+ Enhancements
9
10
 
10
- ### 2.14.1 / 2013-12-29
11
- [full changelog](http://github.com/rspec/rspec-rails/compare/v2.14.0...v2.14.1)
11
+ * Supports Rails 4.1 and Minitest 5. (Patrick Van Stee)
12
12
 
13
13
  Bug fixes
14
14
 
@@ -17,10 +17,8 @@ Bug fixes
17
17
  * Where possible, check against the version of ActiveRecord, rather than
18
18
  Rails. It is possible to use some of rspec-rails without all of Rails.
19
19
  (Darryl Pogue)
20
- * Supports Rails 4.1 and Minitest 5. (Patrick Van Stee, Andy Lindeman)
21
20
  * Explicitly depends on `activemodel`. This allows libraries that do not bring
22
21
  in all of `rails` to use `rspec-rails`. (John Firebaugh)
23
- * Use `__send__` rather than `send` to prevent naming collisions (Bradley Schaefer)
24
22
 
25
23
  ### 2.14.0 / 2013-07-06
26
24
  [full changelog](http://github.com/rspec/rspec-rails/compare/v2.14.0.rc1...v2.14.0)
@@ -0,0 +1,24 @@
1
+ The `rspec:install` generator creates a `.rspec` file, which tells RSpec to
2
+ tell Autotest that you're using RSpec. You'll also need to add the ZenTest and
3
+ autotest-rails gems to your Gemfile:
4
+
5
+ gem "ZenTest", "~> 4.4.2"
6
+ gem "autotest-rails", "~> 4.1.0"
7
+
8
+ If all of the gems in your Gemfile are installed in system gems, you can just
9
+ type
10
+
11
+ autotest
12
+
13
+ If Bundler is managing any gems for you directly (i.e. you've got `:git` or
14
+ `:path` attributes in the Gemfile), however, you may need to run
15
+
16
+ bundle exec autotest
17
+
18
+ If you do, you require Autotest's bundler plugin in a `.autotest` file in the
19
+ project root directory or your home directory:
20
+
21
+ require "autotest/bundler"
22
+
23
+ Now you can just type `autotest`, it should prefix the generated shell command
24
+ with `bundle exec`.
@@ -0,0 +1,24 @@
1
+ RSpec spec are normally generated alongside other application components.
2
+ For instance, `rails generate model` will also generate an RSpec spec file
3
+ for the model.
4
+
5
+ Note that the generators are there to help you get started, but they are no
6
+ substitute for writing your own examples, and they are only guaranteed to work
7
+ out of the box for with Rails' defaults.
8
+
9
+ RSpec generators can also be run independently. For instance,
10
+
11
+ rails generate rspec:model widget
12
+
13
+ will create a new spec file in `spec/models/widget_spec.rb`.
14
+
15
+ The same generator pattern is available for all specs:
16
+
17
+ * scaffold
18
+ * model
19
+ * controller
20
+ * helper
21
+ * view
22
+ * mailer
23
+ * observer
24
+ * integration
@@ -0,0 +1,84 @@
1
+ Install Rails-3
2
+
3
+ $ gem install rails -v "~> 3.0.0"
4
+
5
+ ### Generate an app
6
+
7
+ $ rails new example
8
+ $ cd example
9
+
10
+ ### Add rspec-rails to the Gemfile
11
+
12
+ $ echo 'gem "rspec-rails", :group => [:development, :test]' >> Gemfile
13
+
14
+ ### Install the bundle
15
+
16
+ $ bundle install
17
+
18
+ ### Bootstrap RSpec
19
+
20
+ $ rails generate rspec:install
21
+
22
+ ### Generate a scaffold
23
+
24
+ $ rails generate scaffold Widgets name:string
25
+
26
+ This generates files in the `app` and `spec` directories. The files in the
27
+ `app` directory are generated by Rails, and Rails delegates the generation of
28
+ the files in the `spec` directory to RSpec.
29
+
30
+ ### Run migrations
31
+
32
+ $ rake db:migrate && rake db:test:prepare
33
+
34
+ ### Run RSpec
35
+
36
+ $ rake spec
37
+
38
+ or
39
+
40
+ $ rspec spec --format documentation
41
+
42
+ If all went well, you should see output ending with:
43
+
44
+ 29 examples, 0 failures, 2 pending
45
+
46
+ This output also includes the following controller spec:
47
+
48
+ WidgetsController
49
+ GET index
50
+ assigns all widgets as @widgets
51
+ GET show
52
+ assigns the requested widget as @widget
53
+ GET new
54
+ assigns a new widget as @widget
55
+ GET edit
56
+ assigns the requested widget as @widget
57
+ POST create
58
+ with valid params
59
+ creates a new Widget
60
+ assigns a newly created widget as @widget
61
+ redirects to the created widget
62
+ with invalid params
63
+ assigns a newly created but unsaved widget as @widget
64
+ re-renders the 'new' template
65
+ PUT update
66
+ with valid params
67
+ updates the requested widget
68
+ assigns the requested widget as @widget
69
+ redirects to the widget
70
+ with invalid params
71
+ assigns the widget as @widget
72
+ re-renders the 'edit' template
73
+ DELETE destroy
74
+ destroys the requested widget
75
+ redirects to the widgets list
76
+
77
+ Output like this can help to quickly gain a high level understanding of how an
78
+ object behaves. It also exposes which cases have been specified and which have
79
+ not. Note the balance between the examples for the `create` and `update`
80
+ actions. If the `redirects to the widget` example was missing from one or the
81
+ other, it would be easy to spot.
82
+
83
+ Take a look at the generated `spec/controllers/widgets_controller_spec.rb` to
84
+ get a sense of how to organize your specs to generate output like this.
@@ -0,0 +1,56 @@
1
+ rspec-rails extends Rails' built-in testing framework to support rspec examples
2
+ for requests, controllers, models, views, helpers, mailers and routing.
3
+
4
+ ## Rails-3
5
+
6
+ rspec-rails-2 supports rails-3.0.0 and later. For earlier versions of Rails,
7
+ you need [rspec-rails-1.3](http://rspec.info).
8
+
9
+ ## Install
10
+
11
+ gem install rspec-rails
12
+
13
+ This installs the following gems:
14
+
15
+ rspec
16
+ rspec-core
17
+ rspec-expectations
18
+ rspec-mocks
19
+ rspec-rails
20
+
21
+ ## Configure
22
+
23
+ Add rspec-rails to the :test and :development groups in the Gemfile:
24
+
25
+ group :test, :development do
26
+ gem "rspec-rails", "~> 2.4"
27
+ end
28
+
29
+ It needs to be in the :development group to expose generators and rake tasks
30
+ without having to type RAILS_ENV=test.
31
+
32
+ Now you can run:
33
+
34
+ script/rails generate rspec:install
35
+
36
+ This adds the spec directory and some skeleton files, including a .rspec
37
+ file.
38
+
39
+ ## Webrat and Capybara
40
+
41
+ You can choose between webrat or capybara for simulating a browser, automating
42
+ a browser, or setting expectations using the matchers they supply. Just add
43
+ your preference to the Gemfile:
44
+
45
+ gem "webrat"
46
+ gem "capybara"
47
+
48
+ ## Issues
49
+
50
+ The documentation for rspec-rails is a work in progress. We'll be adding
51
+ Cucumber features over time, and clarifying existing ones. If you have
52
+ specific features you'd like to see added, find the existing documentation
53
+ incomplete or confusing, or, better yet, wish to write a missing Cucumber
54
+ feature yourself, please [submit an
55
+ issue](http://github.com/rspec/rspec-rails/issues) or a [pull
56
+ request](http://github.com/rspec/rspec-rails).
@@ -0,0 +1,4 @@
1
+ rails version | rspec-rails version
2
+ 2.3 | 1.3.4
3
+ 3.0 | >= 2.0
4
+ 3.1 | >= 2.6
@@ -0,0 +1,84 @@
1
+ When you run `rails generate rspec:install`, the `spec/spec_helper.rb` file
2
+ includes the following configuration:
3
+
4
+ RSpec.configure do |config|
5
+ config.use_transactional_fixtures = true
6
+ end
7
+
8
+ The name of this setting is a bit misleading. What it really means in Rails
9
+ is "run every test method within a transaction." In the context of rspec-rails,
10
+ it means "run every example within a transaction."
11
+
12
+ The idea is to start each example with a clean database, create whatever data
13
+ is necessary for that example, and then remove that data by simply rolling back
14
+ the transaction at the end of the example.
15
+
16
+ ### Disabling transactions
17
+
18
+ If you prefer to manage the data yourself, or using another tool like
19
+ [database_cleaner](https://github.com/bmabey/database_cleaner) to do it for you,
20
+ simply tell RSpec to tell Rails not to manage transactions:
21
+
22
+ RSpec.configure do |config|
23
+ config.use_transactional_fixtures = false
24
+ end
25
+
26
+ ### Data created in `before(:each)` are rolled back
27
+
28
+ Any data you create in a `before(:each)` hook will be rolled back at the end of
29
+ the example. This is a good thing because it means that each example is
30
+ isolated from state that would otherwise be left around by the examples that
31
+ already ran. For example:
32
+
33
+ describe Widget do
34
+ before(:each) do
35
+ @widget = Widget.create
36
+ end
37
+
38
+ it "does something" do
39
+ expect(@widget).to do_something
40
+ end
41
+
42
+ it "does something else" do
43
+ expect(@widget).to do_something_else
44
+ end
45
+ end
46
+
47
+ The `@widget` is recreated in each of the two examples above, so each example
48
+ has a different object, _and_ the underlying data is rolled back so the data
49
+ backing the `@widget` in each example is new.
50
+
51
+ ### Data created in `before(:all)` are _not_ rolled back
52
+
53
+ `before(:all)` hooks are invoked before the transaction is opened. You can use
54
+ this to speed things up by creating data once before any example in a group is
55
+ run, however, this introduces a number of complications and you should only do
56
+ this if you have a firm grasp of the implications. Here are a couple of
57
+ guidelines:
58
+
59
+ 1. Be sure to clean up any data in an `after(:all)` hook:
60
+
61
+ before(:all) do
62
+ @widget = Widget.create!
63
+ end
64
+
65
+ after(:all) do
66
+ @widget.destroy
67
+ end
68
+
69
+ If you don't do that, you'll leave data lying around that will eventually
70
+ interfere with other examples.
71
+
72
+ 2. Reload the object in a `before(:each)` hook.
73
+
74
+ before(:all) do
75
+ @widget = Widget.create!
76
+ end
77
+
78
+ before(:each) do
79
+ @widget.reload
80
+ end
81
+
82
+ Even though database updates in each example will be rolled back, the
83
+ object won't _know_ about those rollbacks so the object and its backing
84
+ data can easily get out of sync.
@@ -0,0 +1,121 @@
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 rspec: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/rails'
32
+
33
+ RSpec.configure do |config|
34
+ ...
35
+ end
36
+
37
+ ## Controller specs
38
+
39
+ ### isolation from view templates
40
+
41
+ By default, controller specs do _not_ render view templates. This keeps
42
+ controller specs isolated from the content of views and their requirements.
43
+
44
+ NOTE that the template must exist, but it will not be rendered. This is
45
+ different from rspec-rails-1.x, in which the template didn't need to exist, but
46
+ ActionController makes a number of new decisions in Rails 3 based on the
47
+ existence of the template. To keep the RSpec code free of monkey patches, and
48
+ to keep the rspec user experience simpler, we decided that this would be a fair
49
+ trade-off.
50
+
51
+ ### `response.should render_template`
52
+
53
+ This needs to move from before the action to after. For example:
54
+
55
+ # rspec-rails-1
56
+ controller.should render_template("edit")
57
+ get :edit, :id => "37"
58
+
59
+ # rspec-rails-2
60
+ get :edit, :id => "37"
61
+ response.should render_template("edit")
62
+
63
+ # rspec-rails-2 with expect syntax
64
+ get :edit, :id => "37"
65
+ expect(response).to render_template("edit")
66
+
67
+ rspec-1 had to monkey patch Rails to get render_template to work before the
68
+ action, and this broke a couple of times with Rails releases (requiring urgent
69
+ fix releases in RSpec). Part of the philosophy of rspec-rails-2 is to rely on
70
+ public APIs in Rails as much as possible. In this case, `render_template`
71
+ delegates directly to Rails' `assert_template`, which only works after the
72
+ action.
73
+
74
+ ## View specs
75
+
76
+ ### `view.should render_template`
77
+
78
+ Rails changed the way it renders partials, so to set an expectation that a
79
+ partial gets rendered, you need
80
+
81
+ render
82
+ view.should render_template(:partial => "widget/_row")
83
+
84
+ ### stub_template
85
+
86
+ Introduced in rspec-rails-2.2, simulates the presence of view templates on the
87
+ file system. This supports isolation from partials rendered by the vew template
88
+ that is the subject of a view example:
89
+
90
+ stub_template "widgets/_widget.html.erb" => "This Content"
91
+
92
+ ### No more `have_tag` or `have_text`
93
+
94
+ Before Webrat came along, rspec-rails had its own `have_tag` and `have_text`
95
+ matchers that wrapped Rails' `assert_select`. Webrat included replacements for
96
+ these methods, as well as new matchers (`have_selector` and `have_xpath`), all
97
+ of which rely on Nokogiri to do its work, and are far less brittle than RSpec's
98
+ `have_tag`.
99
+
100
+ Capybara has similar matchers, which will soon be available view specs (they
101
+ are already available in controller specs with `render_views`).
102
+
103
+ Given the brittleness of RSpec's `have_tag` and `have_text` matchers and the
104
+ presence of new Webrat and Capybara matchers that do a better job, `have_tag`
105
+ and `have_text` were not included in rspec-rails-2.
106
+
107
+ ## Mocks, stubs, doubles
108
+
109
+ ### as_new_record
110
+
111
+ Earlier versions of the view generators generated stub_model with `:new_record?
112
+ => true`. That is no longer recognized in rspec-rails-2, so you need to change
113
+ this:
114
+
115
+ stub_model(Widget, :new_record? => true)
116
+
117
+ to this:
118
+
119
+ stub_model(Widget).as_new_record
120
+
121
+ Generators in 2.0.0 final release will do the latter.