summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2015-10-05 20:13:33 +0200
committerHarald Eilertsen <haraldei@anduin.net>2015-10-05 20:13:33 +0200
commit01987cc0b88fdb0748d8d71cca4f5e40ea8a2604 (patch)
tree4e24583b5a111f718a342df59fba62ccf439f4f2 /spec
parent696be9ff4d6a6f7e3286cba14df4e4f449d31bb6 (diff)
downloadnorsk-urskog-registrations-01987cc0b88fdb0748d8d71cca4f5e40ea8a2604.tar.gz
norsk-urskog-registrations-01987cc0b88fdb0748d8d71cca4f5e40ea8a2604.tar.bz2
norsk-urskog-registrations-01987cc0b88fdb0748d8d71cca4f5e40ea8a2604.zip
Redirect back to form and display error if no songs specified.
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