Sha256: 724bb7c5bf95a86360c4ebc0b33f69875028858a0abcf63b7728a94debb4f9c9

Contents?: true

Size: 966 Bytes

Versions: 1

Compression:

Stored size: 966 Bytes

Contents

require 'spec_helper'

describe "DotGrid::Pattern::Grid" do
  describe "#draw" do
    let(:pdf) { double('pdf') }
    let(:params) { { pdf: pdf, bounds: double('bounds', { 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(: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 teh 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

1 entries across 1 versions & 1 rubygems

Version Path
dot_grid-0.0.4 spec/lib/dot_grid/pattern/grid_spec.rb