Sha256: b6dc59616699beac661f10afd0c096ba0336f59844406a743114d13d9c6d7c6e

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'

describe "DotGrid::Planner" do
  describe "#initialize" do
    let(:subject) { DotGrid::Planner.new({}) }

    it "has a default planner color 1" do
      expect(subject.planner_color_1).to eq("CCCCCC")
    end

    it "has a default planner color 2" do
      expect(subject.planner_color_2).to eq("0099ff")
    end
  end

  describe "#generate" do
    let(:pdf) { double('pdf') }
    let(:subject) { DotGrid::Planner.new({:pdf => pdf }) }

    before do
      allow(subject).to receive(:page_width).and_return(10)
      allow(subject).to receive(:page_height).and_return(20)
      allow(pdf).to receive(:start_new_page)
      allow(pdf).to receive(:fill_color)
      allow(pdf).to receive(:fill_rectangle)
      allow(pdf).to receive(:fill_circle)
    end

    it "starts a new page" do
      expect(pdf).to receive(:start_new_page)
      subject.generate
    end

    it "gets the page_width" do
      expect(subject).to receive(:page_width)
      subject.generate
    end

    it "gets the page_height" do
      expect(subject).to receive(:page_height)
      subject.generate
    end

    it "draws the left square grid" do
      expect(subject).to receive(:draw_square_grid_left)
      subject.generate
    end

    it "draws the dot grid" do
      expect(subject).to receive(:draw_dot_grid)
      subject.generate
    end

    it "draws the footer" do
      expect(subject).to receive(:draw_footer)
      subject.generate
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dot_grid-0.0.1 spec/lib/dot_grid/planner_spec.rb