Sha256: 9e81913ca69252b241e35543ecad82e80252c840972411f282675422f5858083

Contents?: true

Size: 833 Bytes

Versions: 5

Compression:

Stored size: 833 Bytes

Contents

require 'spec_helper'

module PivotalToPdf
  describe FormatterFactory do
    describe ".current_formatter" do
      before(:each) do
        Configure.stub(:new).and_return config
      end
      
      context "when the format_class is not defined" do
        let(:config) { double :config }
        it "returns the default formatter" do
          expect(FormatterFactory.formatter).to eq(PivotalToPdf::Formatters::Default)
        end
      end
      
      context "when the format_class is defined" do
        let(:config) { double :config, :formatter => "PivotalToPdf::AClass" }
        before(:each) do
          PivotalToPdf::AClass = Class.new
        end
        
        it "returns the default formatter" do
          expect(FormatterFactory.formatter).to eq(PivotalToPdf::AClass)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pivotal_to_pdf-1.6.0 spec/pivotal_to_pdf/formatter_factory_spec.rb
pivotal_to_pdf-1.4.0 spec/pivotal_to_pdf/formatter_factory_spec.rb
pivotal_to_pdf-1.3.4 spec/pivotal_to_pdf/formatter_factory_spec.rb
pivotal_to_pdf-1.3.3 spec/pivotal_to_pdf/formatter_factory_spec.rb
pivotal_to_pdf-1.3.2 spec/pivotal_to_pdf/formatter_factory_spec.rb