Skip to content

Commit

Permalink
Add explicit hashes to avoid ambiguity with keyword arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
petergoldstein committed Dec 27, 2022
1 parent 5e7c43f commit ead2f5a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec/database_cleaner/cleaner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module DatabaseCleaner
end

it "should pass all arguments to strategy initializer" do
expect(strategy_class).to receive(:new).with(:dollar, :amet, ipsum: "random").and_return(strategy)
expect(strategy_class).to receive(:new).with(:dollar, :amet, { ipsum: "random" }).and_return(strategy)
expect(strategy).to receive(:clean)
cleaner.clean_with :truncation, :dollar, :amet, ipsum: "random"
end
Expand Down Expand Up @@ -145,12 +145,12 @@ module DatabaseCleaner
end

it "should proxy params with symbolised strategies in an array" do
expect(strategy_class).to receive(:new).with(param: "one")
expect(strategy_class).to receive(:new).with({ param: "one" })
cleaner.strategy = [:truncation, param: "one"]
end

it "should proxy params with symbolised strategies in a separate hash" do
expect(strategy_class).to receive(:new).with(param: "one")
expect(strategy_class).to receive(:new).with({ param: "one" })
cleaner.strategy = :truncation, { param: "one" }
end

Expand Down

0 comments on commit ead2f5a

Please sign in to comment.