From 3aea16e9ba194e422e3694ede7d2e0190b049a22 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Wed, 6 Feb 2019 15:06:44 +1100 Subject: [PATCH] Cover alternative invoice template with specs --- spec/services/invoice_renderer_spec.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/services/invoice_renderer_spec.rb b/spec/services/invoice_renderer_spec.rb index e136443a40..7516b86492 100644 --- a/spec/services/invoice_renderer_spec.rb +++ b/spec/services/invoice_renderer_spec.rb @@ -3,13 +3,18 @@ require 'spec_helper' describe InvoiceRenderer do let(:service) { described_class.new } - it "creates a PDF invoice" do + it "creates a PDF invoice with two different templates" do order = create(:completed_order_with_fees) order.bill_address = order.ship_address order.save! result = service.render_to_string(order) - expect(result).to match /^%PDF/ + + allow(Spree::Config).to receive(:invoice_style2?).and_return true + + alternative = service.render_to_string(order) + expect(alternative).to match /^%PDF/ + expect(alternative).to_not eq result end end