Skip to content

Commit

Permalink
Refactored tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SleekMutt committed Dec 8, 2024
1 parent 509a6e0 commit 0e7a248
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spec/services/calculators/peferable_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

describe "#perform!" do
context "when preferable is set to 1" do
let!(:service) { Calculators::PreferableService.new(preferable: 1, slug: calculator1.slug) }

it "updates other calculators to have preferable set to false" do
service = Calculators::PreferableService.new(preferable: 1, slug: calculator1.slug)
service.perform!

expect(calculator1.reload.preferable).to eq(true)
Expand All @@ -18,8 +19,9 @@
end

context "when preferable is not set to 1" do
let!(:service) { Calculators::PreferableService.new(preferable: 0, slug: calculator1.slug) }

it "does not change any preferable values" do
service = Calculators::PreferableService.new(preferable: 0, slug: "calculator1")
service.perform!

expect(calculator1.reload.preferable).to eq(true)
Expand Down

0 comments on commit 0e7a248

Please sign in to comment.