diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/registration_spec.rb | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/spec/registration_spec.rb b/spec/registration_spec.rb index 60d6ac9..8d04d89 100644 --- a/spec/registration_spec.rb +++ b/spec/registration_spec.rb @@ -28,7 +28,7 @@ describe RegistrationApp do end end - describe 'POST submit' do + describe 'submitting a form' do include Mail::Matchers before :each do @@ -95,47 +95,45 @@ describe RegistrationApp do shared_examples_for('form with errors') do |args| let(:band_params) { create_band_params(args) } - describe "form with errors" do - before :each do - post '/submit', 'band' => band_params - end + before :each do + post '/submit', 'band' => band_params + end - it 'should go back to the registration form' do - expect(last_response.body).to match(/form id="registration-form"/) - end + it 'should go back to the registration form' do + expect(last_response.body).to match(/form id="registration-form"/) + end - it 'should display an error message' do - expect(last_response.body).to include("Det er feil i skjemaet") - end + it 'should display an error message' do + expect(last_response.body).to include("Det er feil i skjemaet") end end context 'with no songs' do - it_behaves_like('form with errors', {:songs => 0}) + include_examples('form with errors', {:songs => 0}) end context 'without a band name' do - it_behaves_like('form with errors', {:name => ''}) + include_examples('form with errors', {:name => ''}) end context 'with a band name with only spaces' do - it_behaves_like('form with errors', {:name => ' '}) + include_examples('form with errors', {:name => ' '}) end context 'with no contact' do - it_behaves_like('form with errors', {:contact_name => ''}) + include_examples('form with errors', {:contact_name => ''}) end context 'with no contact address' do - it_behaves_like('form with errors', {:contact_addr => ''}) + include_examples('form with errors', {:contact_addr => ''}) end context 'with no contact phone' do - it_behaves_like('form with errors', {:contact_phone => ''}) + include_examples('form with errors', {:contact_phone => ''}) end context 'with no contact email' do - it_behaves_like('form with errors', {:contact_email => ''}) + include_examples('form with errors', {:contact_email => ''}) end end end |