Skip to content

Commit fc5fe38

Browse files
author
Sam Phippen
committed
Move rails-controller-testing code into RSpec rails configuration.
1 parent 547a940 commit fc5fe38

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
@@ -125,14 +125,4 @@ def using_source_path(path)
125125
'config.warnings = false'
126126
gsub_file '.rspec', '--warnings', ''
127127

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