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
@@ -8,12 +8,7 @@ require 'rspec/autorun'
8
8
  # in spec/support/ and its subdirectories.
9
9
  Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
10
10
 
11
- <% if ::Rails::VERSION::STRING >= '4.1' -%>
12
- # Checks for pending migrations before tests are run.
13
- # If you are not using ActiveRecord, you can remove this line.
14
- ActiveRecord::Migration.maintain_test_schema!
15
-
16
- <% elsif ::Rails::VERSION::STRING >= '4' -%>
11
+ <% if ::Rails::VERSION::STRING >= '4' -%>
17
12
  # Checks for pending migrations before tests are run.
18
13
  # If you are not using ActiveRecord, you can remove this line.
19
14
  ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
@@ -1,5 +1,4 @@
1
1
  require 'delegate'
2
- require 'active_support'
3
2
  require 'active_support/concern'
4
3
 
5
4
  module RSpec
@@ -9,13 +8,7 @@ module RSpec
9
8
  require 'minitest/assertions'
10
9
  Assertions = Minitest::Assertions
11
10
  else
12
- begin
13
- require 'test/unit/assertions'
14
- rescue LoadError
15
- # work around for Rubinius not having a std std-lib
16
- require 'rubysl-test-unit' if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
17
- require 'test/unit/assertions'
18
- end
11
+ require 'test/unit/assertions'
19
12
  Assertions = Test::Unit::Assertions
20
13
  end
21
14
 
@@ -108,10 +101,10 @@ module RSpec
108
101
  # hooks.
109
102
  def setup(*methods)
110
103
  methods.each do |method|
111
- if method.to_s =~ /^setup_(with_controller|fixtures|controller_request_and_response)$/
112
- prepend_before { __send__ method }
104
+ if method.to_s =~ /^setup_(fixtures|controller_request_and_response)$/
105
+ prepend_before { send method }
113
106
  else
114
- before { __send__ method }
107
+ before { send method }
115
108
  end
116
109
  end
117
110
  end
@@ -121,7 +114,7 @@ module RSpec
121
114
  # Wraps `teardown` calls from within Rails' testing framework in
122
115
  # `after` hooks.
123
116
  def teardown(*methods)
124
- methods.each { |method| after { __send__ method } }
117
+ methods.each { |method| after { send method } }
125
118
  end
126
119
  end
127
120
 
@@ -55,10 +55,9 @@ module RSpec::Rails
55
55
  # # ....
56
56
  # end
57
57
  def controller(base_class = nil, &body)
58
- root_controller = defined?(ApplicationController) ? ApplicationController : ActionController::Base
59
58
  base_class ||= RSpec.configuration.infer_base_class_for_anonymous_controllers? ?
60
59
  controller_class :
61
- root_controller
60
+ ApplicationController
62
61
 
63
62
  metadata[:example_group][:described_class] = Class.new(base_class) do
64
63
  def self.name; "AnonymousController"; end
@@ -25,15 +25,15 @@ module RSpec::Rails
25
25
 
26
26
  private
27
27
 
28
- def _controller_path
28
+ def _controller_path(example)
29
29
  example.example_group.described_class.to_s.sub(/Helper/,'').underscore
30
30
  end
31
31
 
32
32
  included do
33
33
  metadata[:type] = :helper
34
34
 
35
- before do
36
- controller.controller_path = _controller_path
35
+ before do |example|
36
+ controller.controller_path = _controller_path(example)
37
37
  end
38
38
  end
39
39
  end
@@ -102,10 +102,6 @@ module RSpec::Rails
102
102
 
103
103
  private
104
104
 
105
- def _default_file_to_render
106
- example.example_group.top_level_description
107
- end
108
-
109
105
  def _default_render_options
110
106
  if ::Rails::VERSION::STRING >= '3.2'
111
107
  # pluck the handler, format, and locale out of, eg, posts/index.de.html.haml
@@ -156,13 +152,14 @@ module RSpec::Rails
156
152
  view.lookup_context.prefixes << _controller_path
157
153
  end
158
154
 
159
- # fixes bug with differing formats
160
- view.lookup_context.view_paths.each(&:clear_cache)
161
-
162
155
  controller.controller_path = _controller_path
163
156
  controller.request.path_parameters[:controller] = _controller_path
164
157
  controller.request.path_parameters[:action] = _inferred_action unless _inferred_action =~ /^_/
165
158
  end
159
+
160
+ let(:_default_file_to_render) do |example|
161
+ example.example_group.top_level_description
162
+ end
166
163
  end
167
164
  end
168
165
  end
@@ -1,4 +1,3 @@
1
- require 'active_support'
2
1
  require 'active_support/core_ext/module/aliasing'
3
2
  require 'rspec/matchers/built_in/have'
4
3
 
@@ -35,10 +35,6 @@ module RSpec::Rails::Matchers
35
35
  rescued_exception.message
36
36
  end
37
37
 
38
- def failure_message_for_should_not
39
- "expected #{@actual.inspect} not to route to #{@expected.inspect}"
40
- end
41
-
42
38
  def description
43
39
  "route #{@actual.inspect} to #{@expected.inspect}"
44
40
  end
@@ -1,5 +1,3 @@
1
- require 'active_support'
2
- require 'active_support/deprecation'
3
1
  require 'active_support/core_ext'
4
2
  require 'active_model'
5
3
 
@@ -31,19 +29,6 @@ module RSpec
31
29
  end
32
30
  end
33
31
 
34
- # Starting with Rails 4.1, ActiveRecord associations are inversible
35
- # by default. This class represents an association from the mocked
36
- # model's perspective.
37
- #
38
- # @private
39
- class Association
40
- attr_accessor :target, :inversed
41
-
42
- def initialize(association_name)
43
- @association_name = association_name
44
- end
45
- end
46
-
47
32
  module ActiveRecordInstanceMethods
48
33
  # Stubs `persisted?` to return `false` and `id` to return `nil`.
49
34
  def destroy
@@ -60,13 +45,6 @@ module RSpec
60
45
  def new_record?
61
46
  !persisted?
62
47
  end
63
-
64
- # Returns an object representing an association from the mocked
65
- # model's perspective. For use by Rails internally only.
66
- def association(association_name)
67
- @associations ||= Hash.new { |h, k| h[k] = Association.new(k) }
68
- @associations[association_name]
69
- end
70
48
  end
71
49
 
72
50
  # Creates a test double representing `string_or_model_class` with common
@@ -149,10 +127,6 @@ EOM
149
127
  #{model_class}.respond_to?(:column_names) && #{model_class}.column_names.include?(method_name.to_s)
150
128
  end
151
129
 
152
- def @object.has_attribute?(attr_name)
153
- __model_class_has_column?(attr_name)
154
- end unless #{stubs.has_key?(:has_attribute?)}
155
-
156
130
  def @object.respond_to?(method_name, include_private=false)
157
131
  __model_class_has_column?(method_name) ? true : super
158
132
  end unless #{stubs.has_key?(:respond_to?)}
@@ -3,12 +3,14 @@ if default = Rake.application.instance_variable_get('@tasks')['default']
3
3
  default.prerequisites.delete('test')
4
4
  end
5
5
 
6
+ spec_prereq = Rails.configuration.generators.options[:rails][:orm] == :active_record ? "test:prepare" : :noop
7
+ task :noop do; end
6
8
  task :default => :spec
7
9
 
8
10
  task :stats => "spec:statsetup"
9
11
 
10
12
  desc "Run all specs in spec directory (excluding plugin specs)"
11
- RSpec::Core::RakeTask.new(:spec => "spec:prepare")
13
+ RSpec::Core::RakeTask.new(:spec => spec_prereq)
12
14
 
13
15
  namespace :spec do
14
16
  types = begin
@@ -19,18 +21,9 @@ namespace :spec do
19
21
  Hash[dirs.map { |d| [d.split('/').last, d] }]
20
22
  end
21
23
 
22
- task :prepare do
23
- ENV['RACK_ENV'] = ENV['RAILS_ENV'] = 'test'
24
- if Rails.configuration.generators.options[:rails][:orm] == :active_record
25
- if ::Rails::VERSION::STRING.to_f < 4.1
26
- Rake::Task["test:prepare"].invoke
27
- end
28
- end
29
- end
30
-
31
24
  types.each do |type, dir|
32
25
  desc "Run the code examples in #{dir}"
33
- RSpec::Core::RakeTask.new(type => "spec:prepare") do |t|
26
+ RSpec::Core::RakeTask.new(type => spec_prereq) do |t|
34
27
  t.pattern = "./#{dir}/**/*_spec.rb"
35
28
  end
36
29
  end
@@ -38,7 +31,7 @@ namespace :spec do
38
31
  # RCov task only enabled for Ruby 1.8
39
32
  if RUBY_VERSION < '1.9'
40
33
  desc "Run all specs with rcov"
41
- RSpec::Core::RakeTask.new(:rcov => "spec:prepare") do |t|
34
+ RSpec::Core::RakeTask.new(:rcov => spec_prereq) do |t|
42
35
  t.rcov = true
43
36
  t.pattern = "./spec/**/*_spec.rb"
44
37
  t.rcov_opts = '--exclude /gems/,/Library/,/usr/,lib/tasks,.bundle,config,/lib/rspec/,/lib/rspec-,spec'
@@ -1,7 +1,7 @@
1
1
  module RSpec
2
2
  module Rails
3
3
  module Version
4
- STRING = '2.14.2'
4
+ STRING = '2.99.0.beta1'
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,36 @@
1
+ require "spec_helper"
2
+ require "autotest/rails_rspec2"
3
+
4
+ describe Autotest::RailsRspec2 do
5
+
6
+ let(:rails_rspec2_autotest) { Autotest::RailsRspec2.new }
7
+
8
+ describe 'exceptions' do
9
+ let(:exceptions_regexp) { rails_rspec2_autotest.exceptions }
10
+
11
+ it "matches './log/test.log'" do
12
+ exceptions_regexp.should match('./log/test.log')
13
+ end
14
+
15
+ it "matches 'log/test.log'" do
16
+ exceptions_regexp.should match('log/test.log')
17
+ end
18
+
19
+ it "does not match './spec/models/user_spec.rb'" do
20
+ exceptions_regexp.should_not match('./spec/models/user_spec.rb')
21
+ end
22
+
23
+ it "does not match 'spec/models/user_spec.rb'" do
24
+ exceptions_regexp.should_not match('spec/models/user_spec.rb')
25
+ end
26
+ end
27
+
28
+ describe 'mappings' do
29
+ it 'runs model specs when support files change' do
30
+ rails_rspec2_autotest.find_order = %w(spec/models/user_spec.rb spec/support/blueprints.rb)
31
+ rails_rspec2_autotest.test_files_for('spec/support/blueprints.rb').should(
32
+ include('spec/models/user_spec.rb'))
33
+ end
34
+ end
35
+
36
+ end
@@ -0,0 +1,97 @@
1
+ require 'spec_helper'
2
+
3
+ # Generators are not automatically loaded by Rails
4
+ require 'generators/rspec/controller/controller_generator'
5
+
6
+ describe Rspec::Generators::ControllerGenerator do
7
+ # Tell the generator where to put its output (what it thinks of as Rails.root)
8
+ destination File.expand_path("../../../../../tmp", __FILE__)
9
+
10
+ before { prepare_destination }
11
+
12
+ describe 'controller specs' do
13
+ subject { file('spec/controllers/posts_controller_spec.rb') }
14
+ describe 'generated by default' do
15
+ before do
16
+ run_generator %w(posts)
17
+ end
18
+
19
+ describe 'the spec' do
20
+ it { should exist }
21
+ it { should contain(/require 'spec_helper'/) }
22
+ it { should contain(/describe PostsController/) }
23
+ end
24
+ end
25
+ describe 'skipped with a flag' do
26
+ before do
27
+ run_generator %w(posts --no-controller_specs)
28
+ end
29
+ it { should_not exist }
30
+ end
31
+ end
32
+
33
+ describe 'view specs' do
34
+ describe 'are not generated' do
35
+ describe 'with no-view-spec flag' do
36
+ before do
37
+ run_generator %w(posts index show --no-view-specs)
38
+ end
39
+ describe 'index.html.erb' do
40
+ subject { file('spec/views/posts/index.html.erb_spec.rb') }
41
+ it { should_not exist }
42
+ end
43
+ end
44
+ describe 'with no actions' do
45
+ before do
46
+ run_generator %w(posts)
47
+ end
48
+ describe 'index.html.erb' do
49
+ subject { file('spec/views/posts/index.html.erb_spec.rb') }
50
+ it { should_not exist }
51
+ end
52
+ end
53
+
54
+ describe 'with --no-template-engine' do
55
+ before do
56
+ run_generator %w(posts index --no-template-engine)
57
+ end
58
+
59
+ describe 'index.html.erb' do
60
+ subject { file('spec/views/posts/index.html._spec.rb') }
61
+ it { should_not exist }
62
+ end
63
+ end
64
+ end
65
+
66
+ describe 'are generated' do
67
+ describe 'with default template engine' do
68
+ before do
69
+ run_generator %w(posts index show)
70
+ end
71
+ describe 'index.html.erb' do
72
+ subject { file('spec/views/posts/index.html.erb_spec.rb') }
73
+ it { should exist }
74
+ it { should contain(/require 'spec_helper'/) }
75
+ it { should contain(/describe "posts\/index.html.erb"/) }
76
+ end
77
+ describe 'show.html.erb' do
78
+ subject { file('spec/views/posts/show.html.erb_spec.rb') }
79
+ it { should exist }
80
+ it { should contain(/require 'spec_helper'/) }
81
+ it { should contain(/describe "posts\/show.html.erb"/) }
82
+ end
83
+ end
84
+ describe 'with haml' do
85
+ before do
86
+ run_generator %w(posts index --template_engine haml)
87
+ end
88
+ describe 'index.html.haml' do
89
+ subject { file('spec/views/posts/index.html.haml_spec.rb') }
90
+ it { should exist }
91
+ it { should contain(/require 'spec_helper'/) }
92
+ it { should contain(/describe "posts\/index.html.haml"/) }
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ # Generators are not automatically loaded by Rails
4
+ require 'generators/rspec/helper/helper_generator'
5
+
6
+ describe Rspec::Generators::HelperGenerator do
7
+ # Tell the generator where to put its output (what it thinks of as Rails.root)
8
+ destination File.expand_path("../../../../../tmp", __FILE__)
9
+
10
+ before { prepare_destination }
11
+
12
+ subject { file('spec/helpers/posts_helper_spec.rb') }
13
+ describe 'generated by default' do
14
+ before do
15
+ run_generator %w(posts)
16
+ end
17
+
18
+ describe 'the spec' do
19
+ it { should exist }
20
+ it { should contain(/require 'spec_helper'/) }
21
+ it { should contain(/describe PostsHelper/) }
22
+ end
23
+ end
24
+ describe 'skipped with a flag' do
25
+ before do
26
+ run_generator %w(posts --no-helper_specs)
27
+ end
28
+ it { should_not exist }
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+ require 'generators/rspec/install/install_generator'
3
+
4
+ describe Rspec::Generators::InstallGenerator do
5
+ destination File.expand_path("../../../../../tmp", __FILE__)
6
+
7
+ before { prepare_destination }
8
+
9
+ it "generates .rspec" do
10
+ run_generator
11
+ file('.rspec').should exist
12
+ end
13
+
14
+ it "generates spec/spec_helper.rb" do
15
+ run_generator
16
+ File.read( file('spec/spec_helper.rb') ).should =~ /^require 'rspec\/autorun'$/m
17
+ end
18
+
19
+ if ::Rails::VERSION::STRING >= '4'
20
+ it "generates spec/spec_helper.rb with a check for pending migrations" do
21
+ run_generator
22
+ File.read( file('spec/spec_helper.rb') ).should =~ /ActiveRecord::Migration\.check_pending!/m
23
+ end
24
+ else
25
+ it "generates spec/spec_helper.rb without a check for pending migrations" do
26
+ run_generator
27
+ File.read( file('spec/spec_helper.rb') ).should_not =~ /ActiveRecord::Migration\.check_pending!/m
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ # Generators are not automatically loaded by Rails
4
+ require 'generators/rspec/integration/integration_generator'
5
+
6
+ describe Rspec::Generators::IntegrationGenerator do
7
+ # Tell the generator where to put its output (what it thinks of as Rails.root)
8
+ destination File.expand_path("../../../../../tmp", __FILE__)
9
+
10
+ before { prepare_destination }
11
+
12
+ describe 'are not generated' do
13
+ before do
14
+ run_generator %w(posts --no-request-specs)
15
+ end
16
+ describe 'index.html.erb' do
17
+ subject { file('spec/requests/posts_spec.rb') }
18
+ it { should_not exist }
19
+ end
20
+ end
21
+
22
+ describe 'are generated' do
23
+ describe 'without webrat matchers by default' do
24
+ before do
25
+ run_generator %w(posts)
26
+ end
27
+ subject { file('spec/requests/posts_spec.rb') }
28
+ it { should exist }
29
+ it { should contain(/require 'spec_helper'/) }
30
+ it { should contain(/describe "GET \/posts"/) }
31
+ it { should contain(/get posts_index_path/) }
32
+ end
33
+ describe 'with webrat matchers' do
34
+ before do
35
+ run_generator %w(posts --webrat)
36
+ end
37
+ subject { file('spec/requests/posts_spec.rb') }
38
+ it { should exist }
39
+ it { should contain(/require 'spec_helper'/) }
40
+ it { should contain(/describe "GET \/posts"/) }
41
+ it { should contain(/visit posts_index_path/) }
42
+ end
43
+ end
44
+ end