Sha256: 1887e76b1a823038c19fdd03f9262d265b8024ed2e3c98990b8a14ec8f8f49cf
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' describe "DotGrid::Pattern::Checkerboard" do let(:pdf) { double('pdf') } let(:params) { { pdf: pdf, bounds: double('bounds', { height: 20.mm, width: 10.mm } ), spacing: 5 } } let(:subject) { DotGrid::Pattern::Checkerboard.new(params) } describe "#rows" do it "calculates the rows based on the bounds" do expect(subject.rows).to eq(4) end end describe "#columns" do it "calculates the rows based on the bounds" do expect(subject.columns).to eq(2) end end describe "#draw" do before do allow(pdf).to receive(:fill_color) allow(pdf).to receive(:fill_rectangle) end it "sets the fill color" do expect(pdf).to receive(:fill_color) subject.draw end it "calls fill rectangle the correct number of times" do allow(subject).to receive(:rows).and_return(2) allow(subject).to receive(:columns).and_return(3) expect(pdf).to receive(:fill_rectangle).exactly(3*4 / 2).times subject.draw end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dot_grid-0.0.4 | spec/lib/dot_grid/pattern/checkerboard_spec.rb |