Skip to content

Commit 87d6bc4

Browse files
committed
let request specs use integration test services
Rails integration tests have some services like assert_select. This makes them available in request specs.
1 parent 9a20df1 commit 87d6bc4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/rspec/rails/example/request_example_group.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
module RSpec
22
module Rails
3+
module IntegrationHelperWarnings
4+
extend ActiveSupport::Concern
5+
[:assert_select, :url_for, :url_options].each do |name|
6+
define_method(name) { |*args| raise "you must upgrade Rails to call #{name}" }
7+
end
8+
end
9+
310
# @api public
411
# Container class for request spec functionality.
512
module RequestExampleGroup
@@ -11,6 +18,12 @@ module RequestExampleGroup
1118
include RSpec::Rails::Matchers::RenderTemplate
1219
include ActionController::TemplateAssertions
1320

21+
begin
22+
include ActionDispatch::IntegrationTest::Behavior
23+
rescue NameError
24+
include IntegrationHelperWarnings
25+
end
26+
1427
# Delegates to `Rails.application`.
1528
def app
1629
::Rails.application

0 commit comments

Comments
 (0)