Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary stubbing from test #2251

Merged
merged 2 commits into from
Jul 18, 2024
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
6 changes: 0 additions & 6 deletions test/models/edition_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,6 @@ def draft_second_edition_from(published_edition)
end

test "should scope publications by assignee" do
stub_request(:get, %r{http://panopticon\.test\.gov\.uk/artefacts/.*\.js})
.to_return(status: 200, body: "{}", headers: {})

a, b = 2.times.map { FactoryBot.create(:guide_edition, panopticon_id: @artefact.id) }

alice, bob, charlie = %w[alice bob charlie].map do |s|
Expand Down Expand Up @@ -568,9 +565,6 @@ def draft_second_edition_from(published_edition)
end

test "should scope publications assigned to nobody" do
stub_request(:get, %r{http://panopticon\.test\.gov\.uk/artefacts/.*\.js})
.to_return(status: 200, body: "{}", headers: {})

a, b = 2.times.map { |_i| FactoryBot.create(:guide_edition, panopticon_id: @artefact.id) }

alice, bob, charlie = %w[alice bob charlie].map do |s|
Expand Down
6 changes: 1 addition & 5 deletions test/unit/services/publish_service_test.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
require "test_helper"

class PublishServiceTest < ActiveSupport::TestCase
setup do
Services.publishing_api.stubs(:publish)
end

should "publish edition to PublishingAPI" do
Services.publishing_api.expects(:publish).with(
content_id,
Expand All @@ -16,7 +12,7 @@ class PublishServiceTest < ActiveSupport::TestCase
end

should "set links" do
Services.publishing_api.expects(:patch_links)
Services.publishing_api.expects(:patch_links).with(content_id, links: { "primary_publishing_organisation" => %w[af07d5a5-df63-4ddc-9383-6a666845ebe9] })
PublishService.call(edition, update_type)
end

Expand Down
6 changes: 0 additions & 6 deletions test/unit/services/service_sign_in_publish_service_test.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
require "test_helper"

class ServiceSignInPublishServiceTest < ActiveSupport::TestCase
setup do
Services.publishing_api.stubs(:put_content)
Services.publishing_api.stubs(:patch_links)
Services.publishing_api.stubs(:publish)
end

should "publish edition to PublishingAPI" do
update_type = nil
Services.publishing_api.expects(:put_content).with(content_id, payload)
Expand Down
1 change: 0 additions & 1 deletion test/unit/services/update_service_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

class UpdateServiceTest < ActiveSupport::TestCase
setup do
Services.publishing_api.stubs(:put_content)
EditionPresenterFactory.stubs(:get_presenter).returns(presenter)
end

Expand Down
Loading