Sha256: 7657961790e8abeee324b62168620ab84c1acc2cacbe505e55c22811eb828fab

Contents?: true

Size: 822 Bytes

Versions: 8

Compression:

Stored size: 822 Bytes

Contents

require 'spec_helper'

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

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

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

    it "calls horizontal line the correct number of times" do
      allow(subject).to receive(:rows).and_return(2)
      expect(pdf).to receive(:stroke_horizontal_line).exactly(2 + 1).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/horizontal_rule_spec.rb
dot_grid-0.0.11 spec/lib/dot_grid/pattern/horizontal_rule_spec.rb
dot_grid-0.0.10 spec/lib/dot_grid/pattern/horizontal_rule_spec.rb
dot_grid-0.0.9 spec/lib/dot_grid/pattern/horizontal_rule_spec.rb
dot_grid-0.0.8 spec/lib/dot_grid/pattern/horizontal_rule_spec.rb
dot_grid-0.0.7 spec/lib/dot_grid/pattern/horizontal_rule_spec.rb
dot_grid-0.0.6 spec/lib/dot_grid/pattern/horizontal_rule_spec.rb
dot_grid-0.0.5 spec/lib/dot_grid/pattern/horizontal_rule_spec.rb