Skip to content

Commit 5b2dee4

Browse files
jrochkindJonRowe
authored andcommitted
Remove IntegrationTest::Behavior from SystemExampleGroup
To better mirror current Rails ActionDispatch::SystemTestCase. And resolve problems with inability to set ActiveJob queue type in systems example group.
1 parent 9aee3b6 commit 5b2dee4

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

features/system_specs/system_specs.feature

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,36 @@ Feature: System spec
4848
When I run `rspec spec/system/widget_system_spec.rb`
4949
Then the exit status should be 0
5050
And the output should contain "1 example, 0 failures"
51+
52+
@system_test
53+
Scenario: the ActiveJob queue_adapter can be changed
54+
Given a file named "spec/system/some_job_system_spec.rb" with:
55+
"""ruby
56+
require "rails_helper"
57+
58+
class SomeJob < ActiveJob::Base
59+
cattr_accessor :job_ran
60+
61+
def perform
62+
@@job_ran = true
63+
end
64+
end
65+
66+
RSpec.describe "spec/system/some_job_system_spec.rb", :type => :system do
67+
describe "#perform_later" do
68+
before do
69+
ActiveJob::Base.queue_adapter = :inline
70+
end
71+
72+
it "perform later SomeJob" do
73+
expect(ActiveJob::Base.queue_adapter).to be_an_instance_of(ActiveJob::QueueAdapters::InlineAdapter)
74+
75+
SomeJob.perform_later
76+
77+
expect(SomeJob.job_ran).to eq(true)
78+
end
79+
end
80+
end
81+
"""
82+
When I run `rspec spec/system/some_job_system_spec.rb`
83+
Then the example should pass

lib/rspec/rails/example/system_example_group.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def app
7171
original_after_teardown =
7272
::ActionDispatch::SystemTesting::TestHelpers::SetupAndTeardown.instance_method(:after_teardown)
7373

74-
other.include ActionDispatch::IntegrationTest::Behavior
7574
other.include ::ActionDispatch::SystemTesting::TestHelpers::SetupAndTeardown
7675
other.include ::ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper
7776
other.include BlowAwayTeardownHooks

0 commit comments

Comments
 (0)