spec/graphics/graphics_shapes_spec.rb in squib-0.3.0 vs spec/graphics/graphics_shapes_spec.rb in squib-0.4.0
- old
+ new
@@ -13,14 +13,19 @@
before(:each) do
@deck = double(Squib::Deck)
@context = double(Cairo::Context)
allow(Cairo::Context).to receive(:new).and_return(@context)
+ allow(@deck).to receive(:dir).and_return('_output')
+ allow(@deck).to receive(:count_format).and_return('%02d')
+ allow(@deck).to receive(:prefix).and_return('card_')
+ allow(@deck).to receive(:antialias).and_return('best')
end
context 'rect' do
it 'make all the expected calls on a smoke test' do
+ expect(@context).to receive(:antialias=).with('subpixel')
expect(@context).to receive(:save).once
expect(@context).to receive(:rounded_rectangle).with(37, 38, 50, 100, 10, 15).twice
expect_stroke('#fff', '#f00', 2.0)
expect(@context).to receive(:restore).once
@@ -31,11 +36,13 @@
end
end
context 'circle' do
it 'make all the expected calls on a smoke test' do
+ expect(@context).to receive(:antialias=).with('subpixel')
expect(@context).to receive(:save).once
+ expect(@context).to receive(:move_to).with(137, 38)
expect(@context).to receive(:circle).with(37, 38, 100).twice
expect_stroke('#fff', '#f00', 2.0)
expect(@context).to receive(:restore).once
card = Squib::Card.new(@deck, 100, 150)
@@ -45,10 +52,11 @@
end
end
context 'triangle' do
it 'make all the expected calls on a smoke test' do
+ expect(@context).to receive(:antialias=).with('subpixel')
expect(@context).to receive(:save).once
expect(@context).to receive(:triangle).with(1, 2, 3, 4, 5, 6).twice
expect_stroke('#fff', '#f00', 2.0)
expect(@context).to receive(:restore).once
@@ -57,9 +65,10 @@
end
end
context 'line' do
it 'make all the expected calls on a smoke test' do
+ expect(@context).to receive(:antialias=).with('subpixel')
expect(@context).to receive(:save).once
expect(@context).to receive(:move_to).with(1, 2).once
expect(@context).to receive(:line_to).with(3, 4).once
expect(@context).to receive(:set_source_color).with('#fff').once
expect(@context).to receive(:set_line_width).with(2.0).once