Sha256: b322afc52cdb284f7a0956835996c07262fe4200e4e2096a768b5785a540ba46

Contents?: true

Size: 932 Bytes

Versions: 4

Compression:

Stored size: 932 Bytes

Contents

# encoding: utf-8

require_relative "spec_helper"

describe "Prawn::View" do
  let(:view_object) { Object.new.tap { |o| o.extend(Prawn::View) } }

  it "provides a Prawn::Document object by default" do
    expect(view_object.document).to be_kind_of(Prawn::Document)
  end

  it "delegates unhandled methods to object returned by document method" do
    doc = mock("Document")
    view_object.stubs(:document => doc)

    doc.expects(:some_delegated_method)

    view_object.some_delegated_method
  end

  it "allows a block-like DSL via the update method" do
    doc = mock("Document")
    view_object.stubs(:document => doc)

    doc.expects(:foo)
    doc.expects(:bar)

    view_object.update do
      foo
      bar
    end
  end

  it "aliases save_as() to document.render_file()" do
    doc = mock("Document")
    doc.expects(:render_file)

    view_object.stubs(:document => doc)

    view_object.save_as("foo.pdf")
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
prawn-git-2.0.1 spec/view_spec.rb
prawn-2.0.1 spec/view_spec.rb
prawn-2.0.0 spec/view_spec.rb
prawn-1.3.0 spec/view_spec.rb