Sha256: 690c4746b6df0ab9874d108f2f3aeab151b32d3eb5e91b915c5cb0454aada42b

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

module ThousandIsland
  module Components
    describe Header do
      let(:prawn_doc) { instance_double('Prawn::Document') }
      let(:bounds) { double(:bounds) }
      let(:header) { described_class.new(prawn_doc) }

      it '#repeated? uses the option value' do
        header.options[:repeated] = true
        expect(header.repeated?).to be true
      end

      context 'interactions with Prawn' do

        before :each do
          allow(prawn_doc).to receive(:bounding_box).and_yield
          allow(bounds).to receive(:height) { std_doc_height }
          allow(bounds).to receive(:width) { std_doc_width }
          allow(prawn_doc).to receive(:bounds) { bounds }
        end

        it 'sizes the box' do
          h = header.options[:height]
          expect(prawn_doc).to receive(:bounding_box).with([0, std_doc_height], width: std_doc_width, height: h)
          header.render
        end
      end

    private
      def std_doc_height
        840
      end

      def std_doc_width
        595
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thousand_island-0.1.2 spec/thousand_island/components/header_spec.rb
thousand_island-0.1.1 spec/thousand_island/components/header_spec.rb
thousand_island-0.1.0 spec/thousand_island/components/header_spec.rb
thousand_island-0.0.1 spec/thousand_island/components/header_spec.rb