summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2015-10-03 17:41:27 +0200
committerHarald Eilertsen <haraldei@anduin.net>2015-10-03 17:47:28 +0200
commit1c48f48073e33875650b687ced05a51e0fd7f7d3 (patch)
tree0426fff05d78335a81c7c2d369e00d29bfbc0028 /spec
parentff7a2f930d58e0cb02ffee76e250a02e6b3c7ce3 (diff)
downloadnorsk-urskog-registrations-1c48f48073e33875650b687ced05a51e0fd7f7d3.tar.gz
norsk-urskog-registrations-1c48f48073e33875650b687ced05a51e0fd7f7d3.tar.bz2
norsk-urskog-registrations-1c48f48073e33875650b687ced05a51e0fd7f7d3.zip
Add route to handle submitted form.
Diffstat (limited to 'spec')
-rw-r--r--spec/registration_spec.rb92
1 files changed, 91 insertions, 1 deletions
diff --git a/spec/registration_spec.rb b/spec/registration_spec.rb
index 1f89321..5f398c0 100644
--- a/spec/registration_spec.rb
+++ b/spec/registration_spec.rb
@@ -6,9 +6,99 @@ describe RegistrationApp do
end
describe 'GET index' do
- it 'displays the registration form' do
+ before :each do
get '/'
+ end
+
+ it 'should succeed' do
expect(last_response).to be_ok
end
+
+ it 'displays the registration form' do
+ expect(last_response.body).to match /form id="registration-form"/
+ end
+
+ it 'displays the add member button' do
+ expect(last_response.body).to match /id="add-member-button"/
+ end
+
+ it 'displays the add song button' do
+ expect(last_response.body).to match /id="add-song-button"/
+ end
+ end
+
+ describe 'POST submit' do
+ context 'with a valid registration' do
+ before :each do
+ params = {
+ 'name' => 'Imbalance',
+ 'city' => 'Oslo',
+ 'website' => 'http://imbalance.no',
+ 'label' => 'Calculated Imperfection',
+ 'shortbio' => 'Thrash metal from Norway',
+ 'contact' => {
+ 'name' => 'Harald Eilertsen',
+ 'addr' => "Gamleveien 13\n1289 Snufstad",
+ 'phone' => '98765432',
+ 'email' => 'mail@imbalance.no'
+ },
+ 'members' => {
+ '1' => {
+ 'name' => 'Harald Eilertsen',
+ 'instrument' => 'Bass/Vocals',
+ 'age' => ''
+ },
+ '2' => {
+ 'name' => 'Welle',
+ 'instrument' => 'Drums',
+ 'age' => ''
+ },
+ '3' => {
+ 'name' => 'Thormodr',
+ 'instrument' => 'Guitar',
+ 'age' => ''
+ }
+ },
+ 'songs' => {
+ '1' => {
+ 'title' => 'Bestial by Nature',
+ 'time' => '02:80',
+ 'isrc' => '',
+ 'performers' => "Harald Eilertsen\nThormod Steinert\nLars Welle",
+ 'composers' => "Harald Eilertsen\nThormod Steinert",
+ 'notes' => 'Rævrukkje rum kjurr!'
+ }
+ }
+ }
+ post '/submit', 'band' => params
+ end
+
+ it 'should succeed' do
+ expect(last_response).to be_ok
+ end
+
+ it 'displays submitted data to user' do
+ expect(last_response).to match /Bandnavn\: Imbalance/
+ expect(last_response).to match /Hjemsted\: Oslo/
+ expect(last_response).to match /Webside\: http\:\/\/imbalance.no/
+ expect(last_response).to match /Plateselskap\: Calculated Imperfection/
+ expect(last_response).to match /Kort bio\: Thrash metal from Norway/
+
+ expect(last_response).to match /Kontaktperson: Harald Eilertsen/
+ expect(last_response).to match /Kontaktadresse: Gamleveien 13\n1289 Snufstad/
+ expect(last_response).to match /Telefon: 98765432/
+ expect(last_response).to match /Epost: mail@imbalance\.no/
+
+ expect(last_response).to match /Harald Eilertsen, Bass\/Vocals/
+ expect(last_response).to match /Welle, Drums/
+ expect(last_response).to match /Thormodr, Guitar/
+
+ expect(last_response).to match /Bestial by Nature/
+ expect(last_response).to match /Spilletid: 02:80/
+ expect(last_response).to match /Utøvere: Harald Eilertsen, Thormod Steinert, Lars Welle/
+ expect(last_response).to match /Låtskrivere: Harald Eilertsen, Thormod Steinert/
+ expect(last_response).to match /Merknad: Rævrukkje rum kjurr!/
+ end
+ end
end
end