Sha256: 37de77ea3210c9aec1f1ed2983e291a97241ca087676d52c40b3d5a4a5572f0a

Contents?: true

Size: 911 Bytes

Versions: 4

Compression:

Stored size: 911 Bytes

Contents

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

      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 = body.options[:height]
          t = body.options[:top]
          expect(prawn_doc).to receive(:bounding_box).with([0, t], width: std_doc_width, height: h)
          body.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/body_spec.rb
thousand_island-0.1.1 spec/thousand_island/components/body_spec.rb
thousand_island-0.1.0 spec/thousand_island/components/body_spec.rb
thousand_island-0.0.1 spec/thousand_island/components/body_spec.rb