Sha256: a571d3fcf50ce488632a54bd4e64d2bf932c89e95764a2055552c00d488c8c06

Contents?: true

Size: 756 Bytes

Versions: 3

Compression:

Stored size: 756 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_header "Content-Disposition", 'attachment; filename="test.pdf"'
    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

3 entries across 3 versions & 1 rubygems

Version Path
prawn_cocktail_rails-0.3.1 spec/integration_spec.rb
prawn_cocktail_rails-0.2.1 spec/integration_spec.rb
prawn_cocktail_rails-0.2.0 spec/integration_spec.rb