From d1c061f1aee62c83e21fb5bf7b26901ab8c12af4 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 4 Oct 2015 14:42:15 +0200 Subject: Flesh out PDF generation. --- spec/registration_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'spec/registration_spec.rb') diff --git a/spec/registration_spec.rb b/spec/registration_spec.rb index c8858cc..2911f6a 100644 --- a/spec/registration_spec.rb +++ b/spec/registration_spec.rb @@ -79,8 +79,9 @@ describe RegistrationApp do } } - class_spy("Prawn::Document") - allow(Prawn::Document).to receive('generate') + @doc_spy = spy("Prawn::Document") + allow(Prawn::Document).to receive('new') { @doc_spy } + allow(@doc_spy).to receive('render_file') post '/submit', 'band' => params end @@ -113,7 +114,8 @@ describe RegistrationApp do end it "generates a PDF file" do - expect(Prawn::Document).to have_received('generate').with("Imbalance.pdf") + expect(Prawn::Document).to have_received('new').with({ :page_size => "A4" }) + expect(@doc_spy).to have_received('render_file').with("Imbalance.pdf") end it 'sends an email to Norsk Urskog' do -- cgit v1.2.3