Skip to content
This repository
  • 20 commits
  • 51 files changed
  • 3 comments
  • 5 contributors

Showing 51 changed files with 419 additions and 375 deletions. Show diff stats Hide diff stats

  1. 1  .gitignore
  2. 6  Gemfile-3-0-stable
  3. 3  Gemfile-3.0.0
  4. 3  Gemfile-3.0.3
  5. 12  Gemfile → Gemfile-base
  6. 5  Gemfile-master
  7. 115  History.md
  8. 4  README.md
  9. 16  Rakefile
  10. 7  Thorfile
  11. 64  Upgrade.md
  12. 9  features/.nav
  13. 23  features/Autotest.md
  14. 127  features/Changelog.md
  15. 60  features/Upgrade.md
  16. 5  features/controller_specs/README.md
  17. 4  features/controller_specs/anonymous_controller.feature
  18. 4  features/controller_specs/isolation_from_views.feature
  19. 102  features/controller_specs/render_views.feature
  20. 6  features/helper_specs/helper_spec.feature
  21. 4  features/mailer_specs/url_helpers.feature
  22. 4  features/matchers/new_record_matcher.feature
  23. 2  features/matchers/redirect_to_matcher.feature
  24. 2  features/matchers/render_template_matcher.feature
  25. 10  features/mocks/mock_model.feature
  26. 4  features/mocks/stub_model.feature
  27. 2  features/model_specs/errors_on.feature
  28. 8  features/model_specs/transactional_examples.feature
  29. 6  features/routing_specs/be_routable_matcher.feature
  30. 2  features/routing_specs/named_routes.feature
  31. 2  features/routing_specs/route_to_matcher.feature
  32. 3  features/step_definitions/{rspec_steps.rb → additional_cli_steps.rb}
  33. 6  features/view_specs/inferred_controller_path.feature
  34. 4  features/view_specs/stub_template.feature
  35. 16  features/view_specs/view_spec.feature
  36. 4  lib/generators/rspec/integration/templates/request_spec.rb
  37. 2  lib/generators/rspec/scaffold/templates/controller_spec.rb
  38. 2  lib/generators/rspec/scaffold/templates/edit_spec.rb
  39. 2  lib/generators/rspec/scaffold/templates/new_spec.rb
  40. 8  lib/rspec/rails/example.rb
  41. 16  lib/rspec/rails/example/controller_example_group.rb
  42. 2  lib/rspec/rails/example/request_example_group.rb
  43. 6  lib/rspec/rails/mocks.rb
  44. 2  lib/rspec/rails/version.rb
  45. 2  lib/rspec/rails/view_rendering.rb
  46. 38  spec/rspec/rails/mocks/ar_classes.rb
  47. 6  spec/rspec/rails/mocks/mock_model_spec.rb
  48. 13  spec/rspec/rails/mocks/stub_model_spec.rb
  49. 8  spec/rspec/rails/view_rendering_spec.rb
  50. 15  templates/Gemfile
  51. 17  templates/Gemfile-base
1  .gitignore
@@ -6,3 +6,4 @@ doc
6 6
 vendor
7 7
 .bundle
8 8
 Gemfile.lock
  9
+Gemfile
6  Gemfile-3-0-stable
... ...
@@ -0,0 +1,6 @@
  1
+instance_eval(File.read("./Gemfile-base"))
  2
+
  3
+gem "rails", :git => "https://github.com/rails/rails.git", :branch => "3-0-stable"
  4
+gem "arel",  :git => "https://github.com/rails/arel.git"
  5
+gem "rack",  :git => "git://github.com/rack/rack.git"
  6
+
3  Gemfile-3.0.0
... ...
@@ -0,0 +1,3 @@
  1
+instance_eval(File.read("./Gemfile-base"))
  2
+
  3
+gem "rails", "3.0.0"
3  Gemfile-3.0.3
... ...
@@ -0,0 +1,3 @@
  1
+instance_eval(File.read("./Gemfile-base"))
  2
+
  3
+gem "rails", "3.0.3"
12  Gemfile → Gemfile-base
... ...
@@ -1,6 +1,6 @@
1 1
 source "http://rubygems.org"
2 2
 
3  
-%w[rspec rspec-core rspec-expectations rspec-mocks].each do |lib|
  3
+%w[rspec rspec-core rspec-expectations rspec-mocks rspec-rails].each do |lib|
4 4
   library_path = File.expand_path("../../#{lib}", __FILE__)
5 5
   if File.exist?(library_path)
6 6
     gem lib, :path => library_path
@@ -9,14 +9,16 @@ source "http://rubygems.org"
9 9
   end
10 10
 end
11 11
 
  12
+gem 'sqlite3-ruby', :require => 'sqlite3'
12 13
 gem "rake", "0.8.7"
13  
-gem "cucumber", "0.9.4"
  14
+gem "cucumber", "0.10.0"
14 15
 gem "aruba", "0.2.2"
15 16
 gem "rcov", "0.9.9"
16 17
 gem "relish", "0.2.0"
17 18
 gem "guard-rspec", "0.1.9"
18 19
 gem "growl", "1.0.3"
19 20
 gem "ZenTest", "~> 4.4.2"
  21
+gem "webrat", "0.7.2"
20 22
 
21 23
 if RUBY_PLATFORM =~ /darwin/
22 24
   gem "autotest-fsevent", "~> 0.2.4"
@@ -34,9 +36,3 @@ end
34 36
 platforms :jruby do
35 37
   gem "jruby-openssl"
36 38
 end
37  
-
38  
-#### rspec-rails only
39  
-gem "rails", :path => File.expand_path("../vendor/rails", __FILE__)
40  
-gem "rack", :git => "git://github.com/rack/rack.git"
41  
-gem 'webrat', "0.7.2"
42  
-gem 'sqlite3-ruby', :require => 'sqlite3'
5  Gemfile-master
... ...
@@ -0,0 +1,5 @@
  1
+instance_eval(File.read("./Gemfile-base"))
  2
+
  3
+gem "rails", :git => "https://github.com/rails/rails.git"
  4
+gem "arel",  :git => "https://github.com/rails/arel.git"
  5
+gem "rack",  :git => "https://github.com/rack/rack.git"
115  History.md
Source Rendered
... ...
@@ -1,114 +1 @@
1  
-## rspec-rails-2 release history
2  
-
3  
-### 2.4.1 / 2011-01-03
4  
-
5  
-[full changelog](http://github.com/rspec/rspec-rails/compare/v2.4.0...2.4.1)
6  
-
7  
-* Bug fixes
8  
-  * fixed bug caused by including some Rails modules before RSpec's
9  
-    RailsExampleGroup
10  
-
11  
-### 2.4.0 / 2011-01-02
12  
-
13  
-[full changelog](http://github.com/rspec/rspec-rails/compare/v2.3.1...2.4.0)
14  
-
15  
-* Enhancements
16  
-  * include ApplicationHelper in helper object in helper specs
17  
-  * include request spec extensions in files in spec/integration
18  
-  * include controller spec extensions in groups that use :type => :controller
19  
-    * same for :model, :view, :helper, :mailer, :request, :routing
20  
-
21  
-* Bug fixes
22  
-  * restore global config.render_views so you only need to say it once
23  
-  * support overriding render_views in nested groups
24  
-  * matchers that delegate to Rails' assertions capture
25  
-    ActiveSupport::TestCase::Assertion (so they work properly now with
26  
-    should_not in Ruby 1.8.7 and 1.9.1)
27  
-
28  
-* Deprecations
29  
-  * include_self_when_dir_matches
30  
-
31  
-### 2.3.1 / 2010-12-16
32  
-
33  
-[full changelog](http://github.com/rspec/rspec-rails/compare/v2.3.0...v2.3.1)
34  
-
35  
-* Bug fixes
36  
-  * respond_to? correctly handles 2 args
37  
-  * scaffold generator no longer fails on autotest directory
38  
-
39  
-### 2.3.0 / 2010-12-12
40  
-
41  
-[full changelog](http://github.com/rspec/rspec-rails/compare/v2.2.1...v2.3.0)
42  
-
43  
-* Changes
44  
-  * Generator no longer generates autotest/autodiscover.rb, as it is no longer
45  
-    needed (as of rspec-core-2.3.0)
46  
-
47  
-### 2.2.1 / 2010-12-01
48  
-
49  
-[full changelog](http://github.com/rspec/rspec-rails/compare/v2.2.0...v2.2.1)
50  
-
51  
-* Bug fixes
52  
-  * Depend on railties, activesupport, and actionpack instead of rails (Piotr
53  
-    Solnica)
54  
-  * Got webrat integration working properly across different types of specs
55  
-
56  
-* Deprecations
57  
-  * --webrat-matchers flag for generators is deprecated. use --webrat instead.
58  
-
59  
-### 2.2.0 / 2010-11-28
60  
-
61  
-[full changelog](http://github.com/rspec/rspec-rails/compare/v2.1.0...v2.2.0)
62  
-
63  
-* Enhancements
64  
-  * Added stub_template in view specs
65  
-
66  
-* Bug fixes
67  
-  * Properly include helpers in views (Jonathan del Strother)
68  
-  * Fix bug in which method missing led to a stack overflow
69  
-  * Fix stack overflow in request specs with open_session
70  
-  * Fix stack overflow in any spec when method_missing was invoked
71  
-  * Add gem dependency on rails ~> 3.0.0 (ensures bundler won't install
72  
-    rspec-rails-2 with rails-2 apps).
73  
-
74  
-### 2.1.0 / 2010-11-07
75  
-
76  
-[full changelog](http://github.com/rspec/rspec-rails/compare/v2.0.1...v2.1.0)
77  
-
78  
-* Enhancements
79  
-  * Move errors_on to ActiveModel to support other AM-compliant ORMs
80  
-
81  
-* Bug fixes
82  
-  * Check for presence of ActiveRecord instead of checking Rails config
83  
-    (gets rspec out of the way of multiple ORMs in the same app)
84  
-
85  
-### 2.0.1 / 2010-10-15
86  
-
87  
-[full changelog](http://github.com/rspec/rspec-rails/compare/v2.0.0...v2.0.1)
88  
-
89  
-* Enhancements
90  
-  * Add option to not generate request spec (--skip-request-specs)
91  
-
92  
-* Bug fixes
93  
-  * Updated the mock_[model] method generated in controller specs so it adds
94  
-    any stubs submitted each time it is called.
95  
-  * Fixed bug where view assigns weren't making it to the view in view specs in Rails-3.0.1.
96  
-    (Emanuele Vicentini)
97  
-
98  
-### 2.0.0 / 2010-10-10
99  
-
100  
-[full changelog](https://github.com/rspec/rspec-rails/compare/ea6bdef...v2.0.0)
101  
-
102  
-* Enhancements
103  
-  * ControllerExampleGroup uses controller as the implicit subject by default (Paul Rosania)
104  
-  * autotest mapping improvements (Andreas Neuhaus)
105  
-  * more cucumber features (Justin Ko)
106  
-  * clean up spec helper (Andre Arko)
107  
-  * add assign(name, value) to helper specs (Justin Ko)
108  
-  * stub_model supports primary keys other than id (Justin Ko)
109  
-  * support choice between Webrat/Capybara (Justin Ko)
110  
-  * support specs for 'abstract' subclasses of ActionController::Base (Mike Gehard)
111  
-  * be_a_new matcher supports args (Justin Ko)
112  
-
113  
-* Bug fixes
114  
-  * support T::U components in mailer and request specs (Brasten Sager)
  1
+See features/Changelog.md
4  README.md
Source Rendered
@@ -9,7 +9,7 @@ NOTE: rspec-2 does _not_ support rails-2. Use rspec-rails-1.3.x for rails-2.
9 9
 The [Cucumber features](http://relishapp.com/rspec/rspec-rails) are the
10 10
 most comprehensive and up-to-date docs for end-users.
11 11
 
12  
-The [RDoc](http://rubydoc.info/gems/rspec-rails/2.3.0/frames) provides additional
  12
+The [RDoc](http://rubydoc.info/gems/rspec-rails/2.4.0/frames) provides additional
13 13
 information for contributors and/or extenders.
14 14
 
15 15
 All of the documentation is open source and a work in progress. If you find it
@@ -34,7 +34,7 @@ This installs the following gems:
34 34
 Add `rspec-rails` to the `:test` and `:development` groups in the Gemfile:
35 35
 
36 36
     group :test, :development do
37  
-      gem "rspec-rails", "~> 2.0.1"
  37
+      gem "rspec-rails", "~> 2.4"
38 38
     end
39 39
 
40 40
 It needs to be in the `:development` group to expose generators and rake
16  Rakefile
... ...
@@ -1,10 +1,12 @@
1  
-unless File.directory?("vendor/rails")
  1
+unless File.exist?('./Gemfile')
2 2
   raise <<-MESSAGE
3  
-You need to clone the rails git repository into ./vendor before you can use any
4  
-of the rake tasks.
5  
-
6  
-    git clone git://github.com/rails/rails.git vendor/rails
  3
+Could not find a Gemfile. Please run any of:
  4
+  thor rails:use 3-0-stable
  5
+  thor rails:use master
  6
+  thor rails:use 3.0.0
  7
+  thor rails:use 3.0.3
7 8
 
  9
+And then run 'bundle install'
8 10
 MESSAGE
9 11
 end
10 12
 require "bundler"
@@ -54,8 +56,8 @@ namespace :generate do
54 56
   task :app do |t|
55 57
     unless File.directory?('./tmp/example_app')
56 58
       sh "bundle exec rails new ./tmp/example_app"
57  
-      sh "cp ./templates/Gemfile ./tmp/example_app/"
58  
-      sh "cp ./specs.watchr ./tmp/example_app/"
  59
+      sh "cp ./templates/Gemfile-base ./tmp/example_app/"
  60
+      sh "cp ./Gemfile ./tmp/example_app/"
59 61
     end
60 62
   end
61 63
 
7  Thorfile
@@ -15,4 +15,11 @@ class Rails < Thor
15 15
       `git fetch`
16 16
     end
17 17
   end
  18
+
  19
+  desc "use VERSION", "copies the appropriate Gemfile to Gemfile"
  20
+  def use(version)
  21
+    `cp ./Gemfile-#{version} ./Gemfile` 
  22
+    `rm ./Gemfile.lock`
  23
+    system "bundle install"
  24
+  end
18 25
 end
64  Upgrade.md
Source Rendered
... ...
@@ -1,63 +1 @@
1  
-# rspec-rails-2.3.0
2  
-
3  
-## autotest integration
4  
-
5  
-Add a .rspec file to the project's root directory (if not already there) to
6  
-tell RSpec to tell Autotest to use RSpec's specialized Autotest class.
7  
-
8  
-NOTE that rspec-core-2.0, 2.1, and 2.2 required an autotest/discover.rb file in
9  
-the project's root directory. This worked with some, but not all versions of
10  
-autotest and/or the autotest command that ships with ZenTest. This new approach
11  
-will work regardless of which version of autotest/ZenTest you are using.
12  
-
13  
-## Webrat and Capybara
14  
-
15  
-Earlier 2.0.0.beta versions depended on Webrat. As of
16  
-rspec-rails-2.0.0.beta.20, this dependency and offers you a choice of using
17  
-webrat or capybara. Just add the library of your choice to your Gemfile.
18  
-
19  
-## Controller specs
20  
-
21  
-### islation from view templates
22  
-
23  
-By default, controller specs do _not_ render view templates. This keeps
24  
-controller specs isolated from the content of views and their requirements.
25  
-
26  
-NOTE that the template must exist, but it will not be rendered.  This is
27  
-different from rspec-rails-1.x, in which the template didn't need to exist, but
28  
-ActionController makes a number of new decisions in Rails 3 based on the
29  
-existence of the template. To keep the RSpec code free of monkey patches, and
30  
-to keep the rspec user experience simpler, we decided that this would be a fair
31  
-trade-off.
32  
-
33  
-## View specs
34  
-
35  
-### view.should render_template
36  
-
37  
-Rails changed the way it renders partials, so to set an expectation that a
38  
-partial gets rendered, you need 
39  
-
40  
-    render
41  
-    view.should render_template(:partial => "widget/_row")
42  
-
43  
-### stub_template
44  
-
45  
-Introduced in rspec-rails-2.2, simulates the presence of view templates on the
46  
-file system. This supports isolation from partials rendered by the vew template
47  
-that is the subject of a view example:
48  
-
49  
-    stub_template "widgets/_widget.html.erb" => "This Content"
50  
-
51  
-### as_new_record
52  
-
53  
-Earlier versions of the view generators generated stub_model with `:new_record?
54  
-=> true`. That is no longer recognized in rspec-rails-2, so you need to change
55  
-this:
56  
-  
57  
-    stub_model(Widget, :new_record? => true)
58  
-
59  
-to this:
60  
-
61  
-    stub_model(Widget).as_new_record
62  
-
63  
-Generators in 2.0.0 final release will do the latter.
  1
+See features/Upgrade.md
9  features/.nav
... ...
@@ -1,8 +1,9 @@
1  
-- GettingStarted.md (Getting started)
2  
-- Upgrade.md
3  
-- Generators.md (Rails generators)
4  
-- Autotest.md (Autotest integration)
  1
+- GettingStarted.md (Start from scratch)
  2
+- Generators.md (Generators)
5 3
 - transactional_examples.feature
  4
+- Autotest.md (Autotest integration)
  5
+- Changelog.md
  6
+- Upgrade.md
6 7
 - model_specs:
7 8
   - errors_on.feature
8 9
 - controller_specs:
23  features/Autotest.md
Source Rendered
... ...
@@ -1,10 +1,17 @@
1  
-The rspec:install generator creates a .rspec file, which tells RSpec to tell
2  
-Autotest that you're using RSpec and Rails. You'll also need to add the ZenTest
3  
-gem to your Gemfile:
  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 4
 
5  
-    gem "ZenTest"
  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
6 17
 
7  
-At this point, if all of the gems in your Gemfile are installed in system gems,
8  
-you can just type autotest. If, however, Bundler is managing any gems for you
9  
-directly (i.e. you've got :git or :path attributes in the Gemfile), you'll need
10  
-to run bundle exec autotest.
127  features/Changelog.md
Source Rendered
... ...
@@ -0,0 +1,127 @@
  1
+### 2.5.0 / 2011-02-05
  2
+
  3
+[full changelog](http://github.com/rspec/rspec-rails/compare/v2.4.1...v2.5.0)
  4
+
  5
+* Enhancements
  6
+  * use index_helper instead of table_name when generating specs (Reza
  7
+    Primardiansyah)
  8
+ 
  9
+* Bug fixes
  10
+  * fixed bug in which `render_views` in a nested group set the value in its
  11
+    parent group.
  12
+  * only include MailerExampleGroup when it is defiend (Steve Sloan)
  13
+  * mock_model.as_null_object.attribute.blank? returns false (Randy Schmidt)
  14
+  * fix typo in request specs (Paco Guzman)
  15
+
  16
+### 2.4.1 / 2011-01-03
  17
+
  18
+[full changelog](http://github.com/rspec/rspec-rails/compare/v2.4.0...v2.4.1)
  19
+
  20
+* Bug fixes
  21
+  * fixed bug caused by including some Rails modules before RSpec's
  22
+    RailsExampleGroup
  23
+
  24
+### 2.4.0 / 2011-01-02
  25
+
  26
+[full changelog](http://github.com/rspec/rspec-rails/compare/v2.3.1...v2.4.0)
  27
+
  28
+* Enhancements
  29
+  * include ApplicationHelper in helper object in helper specs
  30
+  * include request spec extensions in files in spec/integration
  31
+  * include controller spec extensions in groups that use :type => :controller
  32
+    * same for :model, :view, :helper, :mailer, :request, :routing
  33
+
  34
+* Bug fixes
  35
+  * restore global config.render_views so you only need to say it once
  36
+  * support overriding render_views in nested groups
  37
+  * matchers that delegate to Rails' assertions capture
  38
+    ActiveSupport::TestCase::Assertion (so they work properly now with
  39
+    should_not in Ruby 1.8.7 and 1.9.1)
  40
+
  41
+* Deprecations
  42
+  * include_self_when_dir_matches
  43
+
  44
+### 2.3.1 / 2010-12-16
  45
+
  46
+[full changelog](http://github.com/rspec/rspec-rails/compare/v2.3.0...v2.3.1)
  47
+
  48
+* Bug fixes
  49
+  * respond_to? correctly handles 2 args
  50
+  * scaffold generator no longer fails on autotest directory
  51
+
  52
+### 2.3.0 / 2010-12-12
  53
+
  54
+[full changelog](http://github.com/rspec/rspec-rails/compare/v2.2.1...v2.3.0)
  55
+
  56
+* Changes
  57
+  * Generator no longer generates autotest/autodiscover.rb, as it is no longer
  58
+    needed (as of rspec-core-2.3.0)
  59
+
  60
+### 2.2.1 / 2010-12-01
  61
+
  62
+[full changelog](http://github.com/rspec/rspec-rails/compare/v2.2.0...v2.2.1)
  63
+
  64
+* Bug fixes
  65
+  * Depend on railties, activesupport, and actionpack instead of rails (Piotr
  66
+    Solnica)
  67
+  * Got webrat integration working properly across different types of specs
  68
+
  69
+* Deprecations
  70
+  * --webrat-matchers flag for generators is deprecated. use --webrat instead.
  71
+
  72
+### 2.2.0 / 2010-11-28
  73
+
  74
+[full changelog](http://github.com/rspec/rspec-rails/compare/v2.1.0...v2.2.0)
  75
+
  76
+* Enhancements
  77
+  * Added stub_template in view specs
  78
+
  79
+* Bug fixes
  80
+  * Properly include helpers in views (Jonathan del Strother)
  81
+  * Fix bug in which method missing led to a stack overflow
  82
+  * Fix stack overflow in request specs with open_session
  83
+  * Fix stack overflow in any spec when method_missing was invoked
  84
+  * Add gem dependency on rails ~> 3.0.0 (ensures bundler won't install
  85
+    rspec-rails-2 with rails-2 apps).
  86
+
  87
+### 2.1.0 / 2010-11-07
  88
+
  89
+[full changelog](http://github.com/rspec/rspec-rails/compare/v2.0.1...v2.1.0)
  90
+
  91
+* Enhancements
  92
+  * Move errors_on to ActiveModel to support other AM-compliant ORMs
  93
+
  94
+* Bug fixes
  95
+  * Check for presence of ActiveRecord instead of checking Rails config
  96
+    (gets rspec out of the way of multiple ORMs in the same app)
  97
+
  98
+### 2.0.1 / 2010-10-15
  99
+
  100
+[full changelog](http://github.com/rspec/rspec-rails/compare/v2.0.0...v2.0.1)
  101
+
  102
+* Enhancements
  103
+  * Add option to not generate request spec (--skip-request-specs)
  104
+
  105
+* Bug fixes
  106
+  * Updated the mock_[model] method generated in controller specs so it adds
  107
+    any stubs submitted each time it is called.
  108
+  * Fixed bug where view assigns weren't making it to the view in view specs in Rails-3.0.1.
  109
+    (Emanuele Vicentini)
  110
+
  111
+### 2.0.0 / 2010-10-10
  112
+
  113
+[full changelog](https://github.com/rspec/rspec-rails/compare/ea6bdef...v2.0.0)
  114
+
  115
+* Enhancements
  116
+  * ControllerExampleGroup uses controller as the implicit subject by default (Paul Rosania)
  117
+  * autotest mapping improvements (Andreas Neuhaus)
  118
+  * more cucumber features (Justin Ko)
  119
+  * clean up spec helper (Andre Arko)
  120
+  * add assign(name, value) to helper specs (Justin Ko)
  121
+  * stub_model supports primary keys other than id (Justin Ko)
  122
+  * support choice between Webrat/Capybara (Justin Ko)
  123
+  * support specs for 'abstract' subclasses of ActionController::Base (Mike Gehard)
  124
+  * be_a_new matcher supports args (Justin Ko)
  125
+
  126
+* Bug fixes
  127
+  * support T::U components in mailer and request specs (Brasten Sager)
60  features/Upgrade.md
Source Rendered
@@ -36,6 +36,18 @@ is what you need to change:
36 36
 
37 37
 ## Controller specs
38 38
 
  39
+### islation 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
+
39 51
 ### `response.should render_template`
40 52
 
41 53
 This needs to move from before the action to after. For example:
@@ -54,3 +66,51 @@ fix releases in RSpec). Part of the philosophy of rspec-rails-2 is to rely on
54 66
 public APIs in Rails as much as possible. In this case, `render_template`
55 67
 delegates directly to Rails' `assert_template`, which only works after the
56 68
 action.
  69
+
  70
+## View specs
  71
+
  72
+### `view.should render_template`
  73
+
  74
+Rails changed the way it renders partials, so to set an expectation that a
  75
+partial gets rendered, you need 
  76
+
  77
+    render
  78
+    view.should render_template(:partial => "widget/_row")
  79
+
  80
+### stub_template
  81
+
  82
+Introduced in rspec-rails-2.2, simulates the presence of view templates on the
  83
+file system. This supports isolation from partials rendered by the vew template
  84
+that is the subject of a view example:
  85
+
  86
+    stub_template "widgets/_widget.html.erb" => "This Content"
  87
+
  88
+### No more `have_tag`
  89
+
  90
+Before Webrat came along, rspec-rails had its own `have_tag` matcher that
  91
+wrapped Rails' `assert_select`. Webrat included a replacement for `have_tag` as
  92
+well as new matchers (`have_selector` and `have_xpath`), all of which rely on
  93
+Nokogiri to do its work, and are far less brittle than RSpec's `have_tag`.
  94
+
  95
+Capybara has similar matchers, which will soon be available view specs (they
  96
+are already available in controller specs with `render_views`).
  97
+
  98
+Given the brittleness of RSpec's `have_tag` matcher and the presence of new
  99
+Webrat and Capybara matchers that do a better job, `have_tag` was not included
  100
+in rspec-rails-2.
  101
+
  102
+## Mocks, stubs, doubles
  103
+
  104
+### as_new_record
  105
+
  106
+Earlier versions of the view generators generated stub_model with `:new_record?
  107
+=> true`. That is no longer recognized in rspec-rails-2, so you need to change
  108
+this:
  109
+  
  110
+    stub_model(Widget, :new_record? => true)
  111
+
  112
+to this:
  113
+
  114
+    stub_model(Widget).as_new_record
  115
+
  116
+Generators in 2.0.0 final release will do the latter.
5  features/controller_specs/README.md
Source Rendered
@@ -2,8 +2,9 @@ Controller specs live in `spec/controllers` or any example group with
2 2
 `:type => :controller`.
3 3
 
4 4
 A controller spec is an RSpec wrapper for a Rails functional test
5  
-(ActionController::TestCase::Behavior).  It allows you to simulate a single
6  
-http request in each example, and then specify expected outcomes, including:
  5
+([ActionController::TestCase::Behavior](https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/test_case.rb)).
  6
+It allows you to simulate a single http request in each example, and then
  7
+specify expected outcomes such as:
7 8
 
8 9
 * rendered templates
9 10
 * redirects
4  features/controller_specs/anonymous_controller.feature
@@ -37,7 +37,7 @@ Feature: anonymous controller
37 37
     end
38 38
     """
39 39
     When I run "rspec spec"
40  
-    Then the output should contain "1 example, 0 failures"
  40
+    Then the examples should all pass
41 41
 
42 42
   Scenario: specify error handling in subclass of ApplicationController
43 43
     Given a file named "spec/controllers/application_controller_subclass_spec.rb" with:
@@ -75,4 +75,4 @@ Feature: anonymous controller
75 75
     end
76 76
     """
77 77
     When I run "rspec spec"
78  
-    Then the output should contain "1 example, 0 failures"
  78
+    Then the examples should all pass
4  features/controller_specs/isolation_from_views.feature
... ...
@@ -1,6 +1,6 @@
1 1
 Feature: views are stubbed by default
2 2
 
3  
-  By default, controller specs stub views with template that renders an empty
  3
+  By default, controller specs stub views with a template that renders an empty
4 4
   string instead of the views in the app. This allows you specify which view
5 5
   template an action should try to render regardless of whether the template
6 6
   compiles cleanly.
@@ -28,7 +28,7 @@ Feature: views are stubbed by default
28 28
       end
29 29
       """
30 30
     When I run "rspec ./spec"
31  
-    Then the output should contain "2 examples, 0 failures"
  31
+    Then the examples should all pass
32 32
 
33 33
   Scenario: expect template that is not rendered by controller action (fails)
34 34
     Given a file named "spec/controllers/widgets_controller_spec.rb" with:
102  features/controller_specs/render_views.feature
... ...
@@ -1,9 +1,9 @@
1 1
 Feature: render_views
2 2
 
3 3
   You can tell a controller example group to render views with the
4  
-  `render_views` declaration.
  4
+  `render_views` declaration in any individual group, or globally.
5 5
 
6  
-  Scenario: expect template that exists and is rendered by controller (passes)
  6
+  Scenario: render_views directly in a single group
7 7
     Given a file named "spec/controllers/widgets_controller_spec.rb" with:
8 8
       """
9 9
       require "spec_helper"
@@ -11,48 +11,18 @@ Feature: render_views
11 11
       describe WidgetsController do
12 12
         render_views
13 13
 
14  
-        describe "index" do
15  
-          it "renders the index template" do
  14
+        describe "GET index" do
  15
+          it "says 'Listing widgets'" do
16 16
             get :index
17  
-            response.should contain("Listing widgets")
18  
-          end
19  
-
20  
-          it "renders the widgets/index template" do
21  
-            get :index
22  
-            response.should contain("Listing widgets")
  17
+            response.body.should =~ /Listing widgets/m
23 18
           end
24 19
         end
25 20
       end
26 21
       """
27 22
     When I run "rspec spec"
28  
-    Then the output should contain "2 examples, 0 failures"
  23
+    Then the examples should all pass
29 24
 
30  
-  Scenario: expect template that does not exist and is rendered by controller (fails)
31  
-    Given a file named "spec/controllers/widgets_controller_spec.rb" with:
32  
-      """
33  
-      require "spec_helper"
34  
-
35  
-      describe WidgetsController do
36  
-        render_views
37  
-
38  
-        before do
39  
-          def controller.index
40  
-            render :template => "other"
41  
-          end
42  
-        end
43  
-
44  
-        describe "index" do
45  
-          it "renders the other template" do
46  
-            get :index
47  
-          end
48  
-        end
49  
-      end
50  
-      """
51  
-    When I run "rspec spec"
52  
-    Then the output should contain "1 example, 1 failure"
53  
-    And the output should contain "Missing template"
54  
-
55  
-  Scenario: render_views on and off in diff contexts
  25
+  Scenario: render_views on and off in nested groups
56 26
     Given a file named "spec/controllers/widgets_controller_spec.rb" with:
57 27
       """
58 28
       require "spec_helper"
@@ -61,19 +31,30 @@ Feature: render_views
61 31
         context "with render_views" do
62 32
           render_views
63 33
 
64  
-          describe "index" do
  34
+          describe "GET index" do
65 35
             it "renders the actual template" do
66 36
               get :index
67 37
               response.body.should =~ /Listing widgets/m
68 38
             end
69 39
           end
  40
+
  41
+          context "with render_views(false) nested in a group with render_views" do
  42
+            render_views false
  43
+
  44
+            describe "GET index" do
  45
+              it "renders the RSpec generated template" do
  46
+                get :index
  47
+                response.body.should eq("")
  48
+              end
  49
+            end
  50
+          end
70 51
         end
71 52
 
72 53
         context "without render_views" do
73  
-          describe "index" do
  54
+          describe "GET index" do
74 55
             it "renders the RSpec generated template" do
75 56
               get :index
76  
-              response.body.should == ""
  57
+              response.body.should eq("")
77 58
             end
78 59
           end
79 60
         end
@@ -81,26 +62,32 @@ Feature: render_views
81 62
         context "with render_views again" do
82 63
           render_views
83 64
 
84  
-          describe "index" do
  65
+          describe "GET index" do
85 66
             it "renders the actual template" do
86 67
               get :index
87 68
               response.body.should =~ /Listing widgets/m
88 69
             end
89 70
           end
90 71
         end
91  
-
92  
-        context "without render_views again" do
93  
-          describe "index" do
94  
-            it "renders the RSpec generated template" do
95  
-              get :index
96  
-              response.body.should == ""
97  
-            end
98  
-          end
99  
-        end
100 72
       end
101 73
       """
102  
-    When I run "rspec spec"
103  
-    Then the output should contain "4 examples, 0 failures"
  74
+    When I run "rspec spec --format documentation"
  75
+    Then the output should contain:
  76
+      """
  77
+      WidgetsController
  78
+        with render_views
  79
+          GET index
  80
+            renders the actual template
  81
+          with render_views(false) nested in a group with render_views
  82
+            GET index
  83
+              renders the RSpec generated template
  84
+        without render_views
  85
+          GET index
  86
+            renders the RSpec generated template
  87
+        with render_views again
  88
+          GET index
  89
+            renders the actual template
  90
+      """
104 91
 
105 92
   Scenario: render_views globally
106 93
     Given a file named "spec/support/render_views.rb" with:
@@ -114,19 +101,14 @@ Feature: render_views
114 101
       require "spec_helper"
115 102
 
116 103
       describe WidgetsController do
117  
-        describe "index" do
  104
+        describe "GET index" do
118 105
           it "renders the index template" do
119 106
             get :index
120  
-            response.should contain("Listing widgets")
121  
-          end
122  
-
123  
-          it "renders the widgets/index template" do
124  
-            get :index
125  
-            response.should contain("Listing widgets")
  107
+            response.body.should =~ /Listing widgets/m
126 108
           end
127 109
         end
128 110
       end
129 111
       """
130 112
     When I run "rspec spec"
131  
-    Then the output should contain "2 examples, 0 failures"
  113
+    Then the examples should all pass
132 114
     
6  features/helper_specs/helper_spec.feature
@@ -26,7 +26,7 @@ Feature: helper spec
26 26
       end
27 27
       """
28 28
     When I run "rspec spec/helpers/application_helper_spec.rb"
29  
-    Then the output should contain "1 example, 0 failures"
  29
+    Then the examples should all pass
30 30
     
31 31
   Scenario: helper method that accesses an instance variable
32 32
     Given a file named "spec/helpers/application_helper_spec.rb" with:
@@ -51,7 +51,7 @@ Feature: helper spec
51 51
       end
52 52
       """
53 53
     When I run "rspec spec/helpers/application_helper_spec.rb"
54  
-    Then the output should contain "1 example, 0 failures"
  54
+    Then the examples should all pass
55 55
 
56 56
   Scenario: application helper is included in helper object
57 57
     Given a file named "spec/helpers/widgets_helper_spec.rb" with:
@@ -84,4 +84,4 @@ Feature: helper spec
84 84
       end
85 85
       """
86 86
     When I run "rspec spec/helpers/widgets_helper_spec.rb"
87  
-    Then the output should contain "1 example, 0 failures"
  87
+    Then the examples should all pass
4  features/mailer_specs/url_helpers.feature
@@ -16,7 +16,7 @@ Feature: URL helpers in mailer examples
16 16
       end
17 17
       """
18 18
     When I run "rspec spec"
19  
-    Then the output should contain "1 example, 0 failures"
  19
+    Then the examples should all pass
20 20
 
21 21
   Scenario: using URL helpers without default options
22 22
     Given a file named "config/initializers/mailer_defaults.rb" with:
@@ -35,4 +35,4 @@ Feature: URL helpers in mailer examples
35 35
       end
36 36
       """
37 37
     When I run "rspec spec"
38  
-    Then the output should contain "1 example, 0 failures"
  38
+    Then the examples should all pass
4  features/matchers/new_record_matcher.feature
@@ -25,7 +25,7 @@ Feature: be_a_new matcher
25 25
       end
26 26
       """
27 27
     When I run "rspec spec/models/widget_spec.rb"
28  
-    Then the output should contain "4 examples, 0 failures"
  28
+    Then the examples should all pass
29 29
 
30 30
   Scenario: example spec using be_a_new.with
31 31
     Given a file named "spec/models/widget_spec.rb" with:
@@ -67,4 +67,4 @@ Feature: be_a_new matcher
67 67
       end
68 68
       """
69 69
     When I run "rspec spec/models/widget_spec.rb"
70  
-    Then the output should contain "4 examples, 0 failures"
  70
+    Then the examples should all pass
2  features/matchers/redirect_to_matcher.feature
@@ -37,4 +37,4 @@ Feature: redirect_to matcher
37 37
       end
38 38
       """
39 39
     When I run "rspec spec/controllers/widgets_controller_spec.rb"
40  
-    Then the output should contain "4 examples, 0 failures"
  40
+    Then the examples should all pass
2  features/matchers/render_template_matcher.feature
@@ -22,4 +22,4 @@ Feature: render_template matcher
22 22
       end
23 23
       """
24 24
     When I run "rspec spec/controllers/gadgets_spec.rb"
25  
-    Then the output should contain "3 examples, 0 failures"
  25
+    Then the examples should all pass
10  features/mocks/mock_model.feature
@@ -37,7 +37,7 @@ Feature: mock_model
37 37
       end
38 38
       """
39 39
     When I run "rspec spec/models/car_spec.rb"
40  
-    Then the output should contain "3 examples, 0 failures"
  40
+    Then the examples should all pass
41 41
 
42 42
   Scenario: passing a string that represents an existing constant
43 43
     Given a file named "spec/models/widget_spec.rb" with:
@@ -52,7 +52,7 @@ Feature: mock_model
52 52
       end
53 53
       """
54 54
     When I run "rspec spec/models/widget_spec.rb"
55  
-    Then the output should contain "1 example, 0 failures"
  55
+    Then the examples should all pass
56 56
 
57 57
   Scenario: passing a class that does not extend ActiveModel::Naming
58 58
     Given a file named "spec/models/string_spec.rb" with:
@@ -66,7 +66,7 @@ Feature: mock_model
66 66
       end
67 67
       """
68 68
     When I run "rspec spec/models/string_spec.rb"
69  
-    Then the output should contain "1 example, 0 failures"
  69
+    Then the examples should all pass
70 70
 
71 71
   Scenario: passing an Active Record constant
72 72
     Given a file named "spec/models/widget_spec.rb" with:
@@ -95,7 +95,7 @@ Feature: mock_model
95 95
       end
96 96
       """
97 97
     When I run "rspec spec/models/widget_spec.rb"
98  
-    Then the output should contain "4 examples, 0 failures"
  98
+    Then the examples should all pass
99 99
 
100 100
   Scenario: passing an Active Record constant with method stubs
101 101
     Given a file named "spec/models/widget_spec.rb" with:
@@ -128,4 +128,4 @@ Feature: mock_model
128 128
       end
129 129
       """
130 130
     When I run "rspec spec/models/widget_spec.rb"
131  
-    Then the output should contain "3 examples, 0 failures"
  131
+    Then the examples should all pass
4  features/mocks/stub_model.feature
@@ -35,7 +35,7 @@ Feature: stub_model
35 35
       end
36 36
       """
37 37
     When I run "rspec spec/models/widget_spec.rb"
38  
-    Then the output should contain "4 examples, 0 failures"
  38
+    Then the examples should all pass
39 39
     
40 40
   Scenario: passing an Active Record constant with a block of stubs
41 41
     Given a file named "spec/models/widget_spec.rb" with:
@@ -55,4 +55,4 @@ Feature: stub_model
55 55
       end
56 56
       """
57 57
     When I run "rspec spec/models/widget_spec.rb"
58  
-    Then the output should contain "1 example, 0 failures"
  58
+    Then the examples should all pass
2  features/model_specs/errors_on.feature
@@ -29,4 +29,4 @@ Feature: errors_on
29 29
       end
30 30
       """
31 31
     When I run "rspec spec/models/widget_spec.rb"
32  
-    Then the output should contain "4 examples, 0 failures"
  32
+    Then the examples should all pass
8  features/model_specs/transactional_examples.feature
@@ -21,7 +21,7 @@ Feature: transactional examples
21 21
       end
22 22
       """
23 23
     When I run "rspec spec/models/widget_spec.rb"
24  
-    Then the output should contain "3 examples, 0 failures"
  24
+    Then the examples should all pass
25 25
 
26 26
   Scenario: run in transactions (explicit)
27 27
     Given a file named "spec/models/widget_spec.rb" with:
@@ -48,7 +48,7 @@ Feature: transactional examples
48 48
       end
49 49
       """
50 50
     When I run "rspec spec/models/widget_spec.rb"
51  
-    Then the output should contain "3 examples, 0 failures"
  51
+    Then the examples should all pass
52 52
 
53 53
   Scenario: disable transactions (explicit)
54 54
     Given a file named "spec/models/widget_spec.rb" with:
@@ -77,7 +77,7 @@ Feature: transactional examples
77 77
       end
78 78
       """
79 79
     When I run "rspec spec/models/widget_spec.rb"
80  
-    Then the output should contain "3 examples, 0 failures"
  80
+    Then the examples should all pass
81 81
 
82 82
   Scenario: run in transactions with fixture
83 83
     Given a file named "spec/models/thing_spec.rb" with:
@@ -97,7 +97,7 @@ Feature: transactional examples
97 97
         name: MyString
98 98
       """
99 99
     When I run "rspec spec/models/thing_spec.rb"
100  
-    Then the output should contain "1 example, 0 failures"
  100
+    Then the examples should all pass
101 101
 
102 102
 
103 103
 
6  features/routing_specs/be_routable_matcher.feature
@@ -32,7 +32,7 @@ Feature: be_routable matcher
32 32
       """
33 33
 
34 34
     When I run "rspec spec/routing/widgets_routing_spec.rb"
35  
-    Then the output should contain "1 example, 0 failures"
  35
+    Then the examples should all pass
36 36
 
37 37
   Scenario: specify routeable route should be routable (passes)
38 38
     Given a file named "spec/routing/widgets_routing_spec.rb" with:
@@ -47,7 +47,7 @@ Feature: be_routable matcher
47 47
       """
48 48
 
49 49
     When I run "rspec spec/routing/widgets_routing_spec.rb"
50  
-    Then the output should contain "1 example, 0 failures"
  50
+    Then the examples should all pass
51 51
 
52 52
   Scenario: specify non-routeable route should be routable (fails)
53 53
     Given a file named "spec/routing/widgets_routing_spec.rb" with:
@@ -77,4 +77,4 @@ Feature: be_routable matcher
77 77
       """
78 78
 
79 79
     When I run "rspec spec/controllers/widgets_controller_spec.rb"
80  
-    Then the output should contain "1 example, 0 failures"
  80
+    Then the examples should all pass
2  features/routing_specs/named_routes.feature
@@ -15,4 +15,4 @@ Feature: named routes
15 15
       end
16 16
       """
17 17
     When I run "rspec spec"
18  
-    Then the output should contain "1 example, 0 failures"
  18
+    Then the examples should all pass
2  features/routing_specs/route_to_matcher.feature
@@ -19,7 +19,7 @@ Feature: route_to matcher
19 19
       """
20 20
 
21 21
     When I run "rspec spec/routing/widgets_routing_spec.rb"
22  
-    Then the output should contain "1 example, 0 failures"
  22
+    Then the examples should all pass
23 23
 
24 24
   Scenario: route spec for a route that doesn't exist (fails)
25 25
     Given a file named "spec/routing/widgets_routing_spec.rb" with:
3  features/step_definitions/rspec_steps.rb → features/step_definitions/additional_cli_steps.rb
... ...
@@ -1,5 +1,4 @@
1  
-Then /^the example(s)? should( all)? pass$/ do |_,_|
  1
+Then /^the example(s)? should( all)? pass$/ do |_, _|
2 2
   Then %q{the exit status should be 0}
3 3
   Then %q{the output should contain "0 failures"}
4 4
 end
5  
-
6  features/view_specs/inferred_controller_path.feature
@@ -12,7 +12,7 @@ Feature: view spec infers controller path and action
12 12
       end
13 13
       """
14 14
     When I run "rspec spec/views"
15  
-    Then the output should contain "1 example, 0 failures"
  15
+    Then the examples should all pass
16 16
 
17 17
   Scenario: infer action
18 18
     Given a file named "spec/views/widgets/new.html.erb_spec.rb" with:
@@ -26,7 +26,7 @@ Feature: view spec infers controller path and action
26 26
       end
27 27
       """
28 28
     When I run "rspec spec/views"
29  
-    Then the output should contain "1 example, 0 failures"
  29
+    Then the examples should all pass
30 30
 
31 31
   Scenario: do not infer action in a partial
32 32
     Given a file named "spec/views/widgets/_form.html.erb_spec.rb" with:
@@ -40,5 +40,5 @@ Feature: view spec infers controller path and action
40 40
       end
41 41
       """
42 42
     When I run "rspec spec/views"
43  
-    Then the output should contain "1 example, 0 failures"
  43
+    Then the examples should all pass
44 44
 
4  features/view_specs/stub_template.feature
@@ -27,7 +27,7 @@ Feature: stub template
27 27
       <%= render :partial => "gadget", :collection => @gadgets %>
28 28
       """
29 29
     When I run "rspec spec/views/gadgets/list.html.erb_spec.rb"
30  
-    Then the output should contain "1 example, 0 failures"
  30
+    Then the examples should all pass
31 31
 
32 32
   Scenario: stub template that exists
33 33
     Given a file named "spec/views/gadgets/edit.html.erb_spec.rb" with:
@@ -47,5 +47,5 @@ Feature: stub template
47 47
       end
48 48
       """
49 49
     When I run "rspec spec/views/gadgets/edit.html.erb_spec.rb"
50  
-    Then the output should contain "1 example, 0 failures"
  50
+    Then the examples should all pass
51 51
 
16  features/view_specs/view_spec.feature
@@ -22,7 +22,7 @@ Feature: view spec
22 22
       end
23 23
       """
24 24
     When I run "rspec spec/views"
25  
-    Then the output should contain "1 example, 0 failures"
  25
+    Then the examples should all pass
26 26
 
27 27
   Scenario: passing spec with before and nesting
28 28
     Given a file named "spec/views/widgets/index.html.erb_spec.rb" with:
@@ -49,7 +49,7 @@ Feature: view spec
49 49
       end
50 50
       """
51 51
     When I run "rspec spec/views"
52  
-    Then the output should contain "1 example, 0 failures"
  52
+    Then the examples should all pass
53 53
 
54 54
   Scenario: passing spec with explicit template rendering
55 55
     Given a file named "spec/views/widgets/widget.html.erb_spec.rb" with:
@@ -71,7 +71,7 @@ Feature: view spec
71 71
       <h2><%= @widget.name %></h2>
72 72
       """
73 73
     When I run "rspec spec/views"
74  
-    Then the output should contain "1 example, 0 failures"
  74
+    Then the examples should all pass
75 75
 
76 76
   Scenario: passing spec with rendering of locals in a partial
77 77
     Given a file named "spec/views/widgets/_widget.html.erb_spec.rb" with:
@@ -93,7 +93,7 @@ Feature: view spec
93 93
       <h3><%= widget.name %></h3>
94 94
       """
95 95
     When I run "rspec spec/views"
96  
-    Then the output should contain "1 example, 0 failures"
  96
+    Then the examples should all pass
97 97
 
98 98
   Scenario: passing spec with rendering of locals in an implicit partial
99 99
     Given a file named "spec/views/widgets/_widget.html.erb_spec.rb" with:
@@ -115,7 +115,7 @@ Feature: view spec
115 115
       <h3><%= widget.name %></h3>
116 116
       """
117 117
     When I run "rspec spec/views"
118  
-    Then the output should contain "1 example, 0 failures"
  118
+    Then the examples should all pass
119 119
 
120 120
   Scenario: passing spec with rendering of text
121 121
     Given a file named "spec/views/widgets/direct.html.erb_spec.rb" with:
@@ -132,7 +132,7 @@ Feature: view spec
132 132
       end
133 133
       """
134 134
     When I run "rspec spec/views"
135  
-    Then the output should contain "1 example, 0 failures"
  135
+    Then the examples should all pass
136 136
 
137 137
   Scenario: passing spec with rendering of Prototype helper update
138 138
     Given a file named "spec/views/widgets/prototype_update.html.erb_spec.rb" with:
@@ -151,7 +151,7 @@ Feature: view spec
151 151
       end
152 152
       """
153 153
     When I run "rspec spec/views"
154  
-    Then the output should contain "1 example, 0 failures"
  154
+    Then the examples should all pass
155 155
 
156 156
   Scenario: spec with view that accesses helper_method helpers
157 157
     Given a file named "app/views/secrets/index.html.erb" with:
@@ -182,4 +182,4 @@ Feature: view spec
182 182
       end
183 183
       """
184 184
     When I run "rspec spec/views/secrets"
185  
-    Then the output should contain "1 example, 0 failures"
  185
+    Then the examples should all pass
4  lib/generators/rspec/integration/templates/request_spec.rb
@@ -4,10 +4,10 @@
4 4
   describe "GET /<%= table_name %>" do
5 5
     it "works! (now write some real specs)" do
6 6
 <% if webrat? -%>
7  
-      visit <%= table_name %>_path
  7
+      visit <%= index_helper %>_path
8 8
 <% else -%>
9 9
       # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
10  
-      get <%= table_name %>_path
  10
+      get <%= index_helper %>_path
11 11
 <% end -%>
12 12
       response.status.should be(200)
13 13
     end
2  lib/generators/rspec/scaffold/templates/controller_spec.rb
@@ -120,7 +120,7 @@ def <%= mock_file_name %>(stubs={})
120 120
     it "redirects to the <%= table_name %> list" do
121 121
       <%= stub orm_class.find(class_name) %> { <%= mock_file_name %> }
122 122
       delete :destroy, :id => "1"
123  
-      response.should redirect_to(<%= table_name %>_url)
  123
+      response.should redirect_to(<%= index_helper %>_url)
124 124
     end
125 125
   end
126 126
 
2  lib/generators/rspec/scaffold/templates/edit_spec.rb
@@ -21,7 +21,7 @@
21 21
     end
22 22
 <% else -%>
23 23
     # Run the generator again with the --webrat flag if you want to use webrat matchers
24  
-    assert_select "form", :action => <%= file_name %>_path(@<%= file_name %>), :method => "post" do
  24
+    assert_select "form", :action => <%= index_helper %>_path(@<%= file_name %>), :method => "post" do
25 25
 <% for attribute in output_attributes -%>
26 26
       assert_select "<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>", :name => "<%= file_name %>[<%= attribute.name %>]"
27 27
 <% end -%>
2  lib/generators/rspec/scaffold/templates/new_spec.rb
@@ -20,7 +20,7 @@
20 20
     end
21 21
 <% else -%>
22 22
     # Run the generator again with the --webrat flag if you want to use webrat matchers
23  
-    assert_select "form", :action => <%= table_name %>_path, :method => "post" do
  23
+    assert_select "form", :action => <%= index_helper %>_path, :method => "post" do
24 24
 <% for attribute in output_attributes -%>
25 25
       assert_select "<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>", :name => "<%= file_name %>[<%= attribute.name %>]"
26 26
 <% end -%>
8  lib/rspec/rails/example.rb
@@ -18,9 +18,11 @@ def c.escaped_path(*parts)
18 18
   c.include RSpec::Rails::HelperExampleGroup, :type => :helper, :example_group => {
19 19
     :file_path => c.escaped_path(%w[spec helpers])
20 20
   }
21  
-  c.include RSpec::Rails::MailerExampleGroup, :type => :mailer, :example_group => {
22  
-    :file_path => c.escaped_path(%w[spec mailers])
23  
-  }
  21
+  if defined?(RSpec::Rails::MailerExampleGroup)
  22
+    c.include RSpec::Rails::MailerExampleGroup, :type => :mailer, :example_group => {
  23
+      :file_path => c.escaped_path(%w[spec mailers])
  24
+    }
  25
+  end
24 26
   c.include RSpec::Rails::ModelExampleGroup, :type => :model, :example_group => {
25 27
     :file_path => c.escaped_path(%w[spec models])
26 28
   }
16  lib/rspec/rails/example/controller_example_group.rb
@@ -56,15 +56,19 @@ module RSpec::Rails
56 56
   #
57 57
   # RSpec's preferred approach to spec'ing controller behaviour is to isolate
58 58
   # the controller from its collaborators.  By default, therefore, controller
59  
-  # example groups do not render views. This means that a view template need
60  
-  # not even exist in order to run a controller spec, and you can still specify
61  
-  # which template the controller should render.
  59
+  # example groups do not render the views in your app. Due to the way Rails
  60
+  # searches for view templates, the template still needs to exist, but it
  61
+  # won't actually be loaded.
  62
+  #
  63
+  # NOTE that this is different from rspec-rails-1 with rails-2, which did not
  64
+  # require the presence of the file at all. Due to changes in rails-3, this
  65
+  # was no longer feasible in rspec-rails-2.
62 66
   #
63 67
   # == View rendering
64 68
   #
65  
-  # If you prefer a more integrated approach, similar to that of
66  
-  # Rails' functional tests, you can tell controller groups to
67