From 9977cd680abe084232e87d818522672085757afd Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 6 Oct 2015 19:42:47 +0200 Subject: Move Prawn spy out to spec_helper. This stubs out the actual calls to prawn in all examples in the spec. We don't want to generate spurious PDF's during testing. --- spec/registration_spec.rb | 8 -------- spec/spec_helper.rb | 5 +++++ 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'spec') diff --git a/spec/registration_spec.rb b/spec/registration_spec.rb index d76d59e..6532f3e 100644 --- a/spec/registration_spec.rb +++ b/spec/registration_spec.rb @@ -39,10 +39,6 @@ describe RegistrationApp do context 'with a valid registration' do before :each do - @doc_spy = spy("Prawn::Document") - allow(Prawn::Document).to receive('new') { @doc_spy } - allow(@doc_spy).to receive('render_file') - post '/submit', 'band' => create_band_params end @@ -88,10 +84,6 @@ describe RegistrationApp do context 'with no songs' do before :each do - @doc_spy = spy("Prawn::Document") - allow(Prawn::Document).to receive('new') { @doc_spy } - allow(@doc_spy).to receive('render_file') - post '/submit', 'band' => create_band_params(:songs => 0) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0b78dfd..62fd2d1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,6 +9,11 @@ require 'capybara/rspec' RSpec.configure do |config| config.include BandFactory + config.before(:example) do + @doc_spy = spy("Prawn::Document") + allow(Prawn::Document).to receive('new') { @doc_spy } + allow(@doc_spy).to receive('render_file') + end end Mail.defaults do -- cgit v1.2.3