1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
RSpec.describe Magick::Draw, '#fill_pattern' do
it 'accepts an Image argument' do
draw = described_class.new
image = Magick::Image.new(20, 20)
expect { draw.fill_pattern = image }.not_to raise_error
end
it 'accepts an ImageList argument' do
draw = described_class.new
image = Magick::Image.new(20, 20)
image_list = Magick::ImageList.new
image_list << image
expect { draw.fill_pattern = image_list }.not_to raise_error
end
it 'does not accept arbitrary arguments' do
draw = described_class.new
expect { draw.fill_pattern = 1 }.to raise_error(NoMethodError)
end
it 'works' do
draw = described_class.new
expect { draw.fill_pattern = nil }.not_to raise_error
expect do
image1 = Magick::Image.new(10, 10)
image2 = Magick::Image.new(20, 20)
draw.fill_pattern = image1
draw.fill_pattern = image2
end.not_to raise_error
expect { draw.fill_pattern = 'x' }.to raise_error(NoMethodError)
end
end
|