From 448380ae81e3dfe182b9092880d4a314b39d034a Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 4 Oct 2015 12:42:56 +0200 Subject: Add dummy method to generate PDF from registration data. --- spec/registration_spec.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/registration_spec.rb b/spec/registration_spec.rb index ed95fae..c8858cc 100644 --- a/spec/registration_spec.rb +++ b/spec/registration_spec.rb @@ -1,3 +1,5 @@ +require "prawn" + describe RegistrationApp do include Rack::Test::Methods @@ -76,6 +78,10 @@ describe RegistrationApp do } } } + + class_spy("Prawn::Document") + allow(Prawn::Document).to receive('generate') + post '/submit', 'band' => params end @@ -106,7 +112,11 @@ describe RegistrationApp do expect(last_response).to match /Merknad: Rævrukkje rum kjurr!/ end - it 'sends and email to Norsk Urskog' do + it "generates a PDF file" do + expect(Prawn::Document).to have_received('generate').with("Imbalance.pdf") + end + + it 'sends an email to Norsk Urskog' do message = Mail::TestMailer.deliveries.first expect(Mail::TestMailer.deliveries).not_to be_empty expect(message.to).to include('haraldei@anduin.net') -- cgit v1.2.3