summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2016-08-16 21:54:30 +0200
committerHarald Eilertsen <haraldei@anduin.net>2016-08-16 21:54:30 +0200
commit9d3cee906330cbbe2dbd1bd4dcb88aa7c160baca (patch)
tree9c158a38f82c64aef3d16157f9a316d1ff9c5f6a /spec
parent206b14869bc36696fc5a3d4aa37bc030d3844162 (diff)
downloadnorsk-urskog-registrations-9d3cee906330cbbe2dbd1bd4dcb88aa7c160baca.tar.gz
norsk-urskog-registrations-9d3cee906330cbbe2dbd1bd4dcb88aa7c160baca.tar.bz2
norsk-urskog-registrations-9d3cee906330cbbe2dbd1bd4dcb88aa7c160baca.zip
Determine if registrations are open or not from config.
Diffstat (limited to 'spec')
-rw-r--r--spec/registration_spec.rb48
1 files changed, 36 insertions, 12 deletions
diff --git a/spec/registration_spec.rb b/spec/registration_spec.rb
index 8d04d89..387a445 100644
--- a/spec/registration_spec.rb
+++ b/spec/registration_spec.rb
@@ -9,22 +9,46 @@ describe RegistrationApp do
end
describe 'GET index' do
- before :each do
- get '/'
- end
+ context 'when registration is open' do
+ before :each do
+ app.set :accept_registrations, {
+ start: Date.today.iso8601,
+ stop: (Date.today + 1).iso8601
+ }
+ get '/'
+ end
- it 'should succeed' do
- expect(last_response).to be_ok
- 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 registration form' do
- expect(last_response.body).to match(/form id="registration-form"/)
+ it 'allows three songs' do
+ expect(last_response.body).to match(/Låt nr. 1/)
+ expect(last_response.body).to match(/Låt nr. 2/)
+ expect(last_response.body).to match(/Låt nr. 3/)
+ end
end
- it 'allows three songs' do
- expect(last_response.body).to match(/Låt nr. 1/)
- expect(last_response.body).to match(/Låt nr. 2/)
- expect(last_response.body).to match(/Låt nr. 3/)
+ context 'when registration is closed' do
+ before :each do
+ app.set :accept_registrations, {
+ start: (Date.today + 1).iso8601,
+ stop: (Date.today + 30).iso8601
+ }
+ get '/'
+ end
+
+ it 'should succeed' do
+ expect(last_response).to be_ok
+ end
+
+ it 'displays message that registration is closed' do
+ expect(last_response.body).to match(/Registreringen er stengt/)
+ end
end
end