Sha256: fab577dacb547856391dc80dd19fed3ef40d1fcbc363baf066d4ef4d591ffd0e

Contents?: true

Size: 831 Bytes

Versions: 8

Compression:

Stored size: 831 Bytes

Contents

require 'spec_helper'

describe "DotGrid::Pattern::DotGrid" do
  describe "#draw" do
    let(:pdf) { double('pdf') }
    let(:params) { { pdf: pdf, bounds: double('bounds', { upper_left: [0, 0], height: 20.mm, width: 10.mm } ), spacing: 5 } }
    let(:subject) { DotGrid::Pattern::DotGrid.new(params) }

    before do
      allow(pdf).to receive(:bounding_box).and_yield
      allow(pdf).to receive(:fill_color)
      allow(pdf).to receive(:fill_circle)
    end

    it "sets the fill color" do
      expect(pdf).to receive(:fill_color)
      subject.draw
    end

    it "calls fill circle 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_circle).exactly(3*4).times
      subject.draw
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dot_grid-0.0.12 spec/lib/dot_grid/pattern/dot_grid_spec.rb
dot_grid-0.0.11 spec/lib/dot_grid/pattern/dot_grid_spec.rb
dot_grid-0.0.10 spec/lib/dot_grid/pattern/dot_grid_spec.rb
dot_grid-0.0.9 spec/lib/dot_grid/pattern/dot_grid_spec.rb
dot_grid-0.0.8 spec/lib/dot_grid/pattern/dot_grid_spec.rb
dot_grid-0.0.7 spec/lib/dot_grid/pattern/dot_grid_spec.rb
dot_grid-0.0.6 spec/lib/dot_grid/pattern/dot_grid_spec.rb
dot_grid-0.0.5 spec/lib/dot_grid/pattern/dot_grid_spec.rb