Sha256: 49d72b91cc0cb58e9737d29726cbd01c4bf0dfa77147116dab01ca6499357576

Contents?: true

Size: 814 Bytes

Versions: 2

Compression:

Stored size: 814 Bytes

Contents

require 'spec_helper'

RSpec.describe "Order Invoice Generation" do
  describe "GET show" do
    let(:order) { FactoryGirl.create(:completed_order_with_totals) }
    let(:user) { FactoryGirl.create(:admin_user, password: "testing123") }
    let(:headers) {{ "X-Spree-Token" => user.spree_api_key }}

    it "returns a pdf" do
      # The invoice generation feature is restricted to admins
      post(spree.login_path, 'spree_user[email]' => user.email, 'spree_user[password]' => 'testing123')
      get(spree.admin_order_path(order.number, :pdf))

      aggregate_failures "pdf response is successful" do
        expect(response).to be_success
        expect(response.headers["Content-Type"]).to eql("application/pdf; charset=utf-8")
        expect(response.body).to start_with('%PDF')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_print_invoice-1.0.2 spec/requests/admin_orders_controller_spec.rb
solidus_print_invoice-1.0.1 spec/requests/admin_orders_controller_spec.rb