Sha256: dcf72c95de7161dc9a435d32fb3638cbc5601a958bb1793a8cc47aebdc9c3e5d

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

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

  describe "#new" do
    it "calls the post initialize method" do
      expect_any_instance_of(DotGrid::Pattern::Pattern).to receive(:post_initialize)
      DotGrid::Pattern::Pattern.new(params)
    end
  end

  describe "#post_initialize" do
    it "is nil" do
      expect(subject.post_initialize({})).to be_nil
    end
  end

  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
    it "raises an error" do
      expect { subject.draw }.to raise_error
    end
  end

  describe "#draw_grid" do
    let(:pdf) { double('null object').as_null_object }

    it "sets the bounding box" do
      expect(pdf).to receive(:bounding_box)
      subject.draw_grid
    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/pattern_spec.rb
dot_grid-0.0.11 spec/lib/dot_grid/pattern/pattern_spec.rb
dot_grid-0.0.10 spec/lib/dot_grid/pattern/pattern_spec.rb
dot_grid-0.0.9 spec/lib/dot_grid/pattern/pattern_spec.rb
dot_grid-0.0.8 spec/lib/dot_grid/pattern/pattern_spec.rb
dot_grid-0.0.7 spec/lib/dot_grid/pattern/pattern_spec.rb
dot_grid-0.0.6 spec/lib/dot_grid/pattern/pattern_spec.rb
dot_grid-0.0.5 spec/lib/dot_grid/pattern/pattern_spec.rb