Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ GEM
cssbundling-rails (1.4.3)
railties (>= 6.0.0)
csv (3.3.6)
date (3.5.1)
date (3.6.0)
debug (1.11.1)
irb (~> 1.10)
reline (>= 0.3.8)
Expand Down Expand Up @@ -156,7 +156,7 @@ GEM
goldiloader (6.0.0)
activerecord (>= 7.2, < 8.3)
activesupport (>= 7.2, < 8.3)
good_job (4.20.0)
good_job (4.22.0)
activejob (>= 6.1.0)
activerecord (>= 6.1.0)
concurrent-ruby (>= 1.3.1)
Expand Down Expand Up @@ -223,7 +223,7 @@ GEM
pg (1.7.0)
pp (0.6.4)
prettyprint
prettyprint (0.2.0)
prettyprint (0.2.1)
prism (1.9.0)
private_address_check (0.8.0)
propshaft (1.3.2)
Expand Down Expand Up @@ -325,14 +325,14 @@ GEM
rspec-support (3.13.7)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.91.0)
rubocop (1.92.0)
json (>= 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (>= 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
regexp_parser (>= 2.11.3, < 3.0)
rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
Expand Down Expand Up @@ -361,9 +361,9 @@ GEM
lint_roller (~> 1.1)
regexp_parser (>= 2.0)
rubocop (~> 1.86, >= 1.86.2)
rubocop-rspec_rails (2.32.0)
rubocop-rspec_rails (2.33.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop (~> 1.89)
rubocop-rspec (~> 3.5)
ruby-progressbar (1.13.0)
rubyzip (3.7.0)
Expand All @@ -376,7 +376,7 @@ GEM
scout_apm (6.3.1)
parser
securerandom (0.4.1)
selenium-webdriver (4.50.0)
selenium-webdriver (4.51.0)
base64 (~> 0.2)
logger (~> 1.4)
rubyzip (>= 1.2.2, < 4.0)
Expand All @@ -397,7 +397,7 @@ GEM
thor (1.5.0)
thread (0.2.2)
timeout (0.6.1)
tins (1.60.0)
tins (1.61.0)
bigdecimal
irb
mize (~> 0.6)
Expand All @@ -412,13 +412,13 @@ GEM
unicode-display_width (3.3.0)
unicode-emoji (~> 4.3)
unicode-emoji (4.3.0)
uri (1.1.1)
uri (1.1.2)
useragent (0.16.11)
web-console (4.3.0)
actionview (>= 8.0.0)
bindex (>= 0.4.0)
railties (>= 8.0.0)
webmock (3.26.4)
webmock (3.29.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand Down
1 change: 1 addition & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
RSpec.configure do |config|
config.include(RequestHelpers, type: :request)
config.include(SystemHelpers, type: :system)
config.include(JobHelpers)
config.include(ActiveSupport::Testing::TimeHelpers)

config.use_transactional_fixtures = true
Expand Down
9 changes: 0 additions & 9 deletions spec/requests/feeds_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,6 @@ def params(feed, **overrides)
end
end

def with_test_adapter
adapter = ActiveJob::Base.queue_adapter
ActiveJob::Base.queue_adapter = :test

yield

ActiveJob::Base.queue_adapter = adapter
end

describe "#create" do
context "when the feed url is valid" do
feed_url = "http://example.com/"
Expand Down
12 changes: 12 additions & 0 deletions spec/support/job_helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module JobHelpers
def with_test_adapter
adapter = ActiveJob::Base.queue_adapter
ActiveJob::Base.queue_adapter = :test

yield
ensure
ActiveJob::Base.queue_adapter = adapter
end
end
8 changes: 5 additions & 3 deletions spec/system/add_feed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ def submit_feed(url)
it "allows adding a new feed" do
login_as(default_user)
stub_discovery(url: "http://example.com/feed.xml")
expect(CallableJob).to receive(:perform_later)

submit_feed("http://example.com/feed.xml")
with_test_adapter do
submit_feed("http://example.com/feed.xml")

expect(page).to have_text("We've added your new feed")
expect(page).to have_text("We've added your new feed")
expect(CallableJob).to have_been_enqueued
end
end

it "shows an error when the feed is not found" do
Expand Down
10 changes: 4 additions & 6 deletions spec/system/tutorial_spec.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# frozen_string_literal: true

RSpec.describe "tutorial" do
def visit_tutorial
expect(CallableJob).to receive(:perform_later)
visit(setup_tutorial_path)
end
around { |example| with_test_adapter(&example) }

it "displays the tutorial page" do
login_as(default_user)

visit_tutorial
visit(setup_tutorial_path)

expect(page).to have_text("Stringer is simple")
expect(CallableJob).to have_been_enqueued
end

it "displays sample stories" do
login_as(default_user)

visit_tutorial
visit(setup_tutorial_path)

expect(page).to have_text("Darin' Fireballs")
end
Expand Down
Loading