From 9234e59e100b3d40478b6aca2375bde85601997f Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 9 Aug 2016 23:39:29 +0200 Subject: Reenable registration form and make tests pass. --- registration.rb | 8 ++++---- spec/features/register_band_spec.rb | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/registration.rb b/registration.rb index ecf8321..3638ed7 100644 --- a/registration.rb +++ b/registration.rb @@ -14,10 +14,10 @@ class RegistrationApp < Sinatra::Base config_file File.join(settings.root, 'config.yml') get '/' do - erb :registration_closed - #@band = Band.new - #3.times { @band.songs << Song.new } - #erb :index + #erb :registration_closed + @band = Band.new + 3.times { @band.songs << Song.new } + erb :index end post '/submit' do diff --git a/spec/features/register_band_spec.rb b/spec/features/register_band_spec.rb index a2bd454..798b0a8 100644 --- a/spec/features/register_band_spec.rb +++ b/spec/features/register_band_spec.rb @@ -7,7 +7,7 @@ feature "Submit registration form" do end context "with all fields filled in" do - scenario "displays thank you page", js: true do + scenario "displays thank you page" do fill_in_form_with(@band_params) expect(page).to have_content "Takk for at du vil være med på Norsk Urskog" @@ -29,7 +29,7 @@ feature "Submit registration form" do end context "with invalid data" do - scenario "retains submitted data in form", js: true do + scenario "retains submitted data in form" do @band_params['name'] = "" fill_in_form_with(@band_params) @@ -38,11 +38,11 @@ feature "Submit registration form" do expect(find_field('Webside:').value).to eql(@band_params['website']) expect(find_field('Plateselskap:').value).to eql(@band_params['label']) expect(find_field('Kort bio:').value).to eql(@band_params['shortbio']) - expect(find_field('Medlemmer:').value).to eql(@band_params['members']) + expect(find_field('Medlemmer:').value.gsub("\r\n", "\n")).to eql(@band_params['members']) within ('#form-contact-info') do expect(find_field('Navn:').value).to eql(@band_params['contact']['name']) - expect(find_field('Postadresse:').value).to eql(@band_params['contact']['addr']) + expect(find_field('Postadresse:').value.gsub("\r\n", "\n")).to eql(@band_params['contact']['addr']) expect(find_field('Tlf:').value).to eql(@band_params['contact']['phone']) expect(find_field('E-post:').value).to eql(@band_params['contact']['email']) end @@ -51,8 +51,8 @@ feature "Submit registration form" do expect(find_field('Låttittel:').value).to eql(@band_params['songs']['1']['title']) expect(find_field('Lengde:').value).to eql(@band_params['songs']['1']['time']) expect(find_field('ISRC-kode:').value).to eql(@band_params['songs']['1']['isrc']) - expect(find_field('Utøvere:').value).to eql(@band_params['songs']['1']['performers']) - expect(find_field('Opphavsmenn:').value).to eql(@band_params['songs']['1']['composers']) + expect(find_field('Utøvere:').value.gsub("\r\n", "\n")).to eql(@band_params['songs']['1']['performers']) + expect(find_field('Opphavsmenn:').value.gsub("\r\n", "\n")).to eql(@band_params['songs']['1']['composers']) expect(find_field('Andre merknader:').value).to eql(@band_params['songs']['1']['notes']) end end -- cgit v1.2.3