Sha256: 154534115ca7bf37ca0aa18b70c7e3d5abaface193c0b8d00ade303e38de3c0f

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe "DotGrid::Pattern::Grid" 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::Grid.new(params) }

    before do
      allow(pdf).to receive(:stroke_color)
      allow(pdf).to receive(:bounding_box).and_yield
      allow(pdf).to receive(:stroke_horizontal_line)
      allow(pdf).to receive(:stroke_vertical_line)
    end

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

    it "draws the horizontal lines" do
      allow(subject).to receive(:rows).and_return(2)
      expect(pdf).to receive(:stroke_horizontal_line).exactly(3).times
      subject.draw
    end

    it "calls fill rectangle the correct number of times" do
      allow(subject).to receive(:columns).and_return(3)
      expect(pdf).to receive(:stroke_vertical_line).exactly(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/grid_spec.rb
dot_grid-0.0.11 spec/lib/dot_grid/pattern/grid_spec.rb
dot_grid-0.0.10 spec/lib/dot_grid/pattern/grid_spec.rb
dot_grid-0.0.9 spec/lib/dot_grid/pattern/grid_spec.rb
dot_grid-0.0.8 spec/lib/dot_grid/pattern/grid_spec.rb
dot_grid-0.0.7 spec/lib/dot_grid/pattern/grid_spec.rb
dot_grid-0.0.6 spec/lib/dot_grid/pattern/grid_spec.rb
dot_grid-0.0.5 spec/lib/dot_grid/pattern/grid_spec.rb