summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/registration_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/registration_spec.rb b/spec/registration_spec.rb
index be4e6f7..3d7deed 100644
--- a/spec/registration_spec.rb
+++ b/spec/registration_spec.rb
@@ -84,5 +84,24 @@ describe RegistrationApp do
expect(message.subject).to match /Registrering av band Imbalance til Norsk Urskog/
end
end
+
+ 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
+
+ it 'should reject request and go back to the registration form' do
+ expect(last_response.status).to eq(302)
+ end
+
+ it 'should display an error message' do
+ follow_redirect!
+ expect(last_response.body).to include "Du må ha med minst én låt"
+ end
+ end
end
end