Skip to content

Commit

Permalink
Fix spec broken in Ruby 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mogest committed Dec 16, 2023
1 parent b2ae92c commit 5140da1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions spec/prawn/svg/interface_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,19 @@
end

context "when fill_and_stroke is issued" do
def expect_rectangle
if RUBY_VERSION.start_with?("2.7.")
expect(prawn).to receive(:rectangle)
else
expect(prawn).to receive(:rectangle).with([0, 100], 10, 10)
end
end

context "and fill rule is not set" do
let(:interface) { Prawn::SVG::Interface.new('<svg width="250" height="100"><rect width="10" height="10" stroke="red"></rect></svg>', prawn, {}) }

it "adds content 'B'" do
expect(prawn).to receive(:rectangle).with([0, 100], 10, 10)
expect_rectangle
expect(prawn).to receive(:add_content).with("W n")
expect(prawn).to receive(:add_content).with("B")
interface.draw
Expand All @@ -54,7 +62,7 @@
let(:interface) { Prawn::SVG::Interface.new('<svg width="250" height="100"><rect width="10" height="10" stroke="red" fill-rule="evenodd"></rect></svg>', prawn, {}) }

it "adds content 'B*'" do
expect(prawn).to receive(:rectangle).with([0, 100], 10, 10)
expect_rectangle
expect(prawn).to receive(:add_content).with("W n")
expect(prawn).to receive(:add_content).with("B*")
interface.draw
Expand Down

0 comments on commit 5140da1

Please sign in to comment.