Sha256: acf61de4328f0ea8280a1ca59dd7a30c0e625efea89681185d64fa61dbca0538

Contents?: true

Size: 777 Bytes

Versions: 1

Compression:

Stored size: 777 Bytes

Contents

# Load dummy Rails app.
ENV["RAILS_ENV"] ||= "test"
require_relative "dummy/config/environment.rb"
require "rails/test_help"

require "pdf/inspector"
require "minitest/pride"

class IntegrationTest < ActionController::TestCase
  tests DummyController

  def test_integration
    get :show
    assert_header "Content-Type", "application/pdf"
    assert_match %r{attachment; filename="test\.pdf"}, response.headers["Content-Disposition"]
    assert_pdf_strings [
      "Helper works.",
      "Message: test.",
    ]
  end
end

def assert_header(name, value)
  assert_equal value, response.headers[name]
end

def assert_pdf_strings(strings)
  assert_equal strings, parse_strings(response.body)
end

def parse_strings(pdf_data)
  PDF::Inspector::Text.analyze(pdf_data).strings
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prawn_cocktail_rails-0.3.2 spec/integration_spec.rb