Skip to content

Commit 21a4c6c

Browse files
author
Sam Phippen
committed
Move rails-controller-testing code into RSpec rails configuration.
1 parent 9f6c7ed commit 21a4c6c

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

example_app_generator/generate_stuff.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,4 @@ def using_source_path(path)
126126
'config.warnings = false'
127127
gsub_file '.rspec', '--warnings', ''
128128

129-
append_to_file 'spec/rails_helper.rb', <<-EOT.gsub(/^ +\|/, '')
130-
|RSpec.configure do |config|
131-
| [:controller, :view, :request].each do |type|
132-
| config.include Rails::Controller::Testing::TestProcess, :type => type
133-
| config.include Rails::Controller::Testing::TemplateAssertions, :type => type
134-
| config.include Rails::Controller::Testing::Integration, :type => type
135-
| end
136-
|end
137-
EOT
138-
139129
final_tasks

lib/rspec/rails/configuration.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ def filter_rails_from_backtrace!
106106
config.include RSpec::Rails::ViewExampleGroup, :type => :view
107107
config.include RSpec::Rails::FeatureExampleGroup, :type => :feature
108108

109+
if defined?(::Rails::Controller::Testing)
110+
[:controller, :view, :request].each do |type|
111+
config.include ::Rails::Controller::Testing::TestProcess, :type => type
112+
config.include ::Rails::Controller::Testing::TemplateAssertions, :type => type
113+
config.include ::Rails::Controller::Testing::Integration, :type => type
114+
end
115+
end
116+
109117
if defined?(ActionMailer)
110118
config.include RSpec::Rails::MailerExampleGroup, :type => :mailer
111119
end

0 commit comments

Comments
 (0)