summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/band.rb4
-rw-r--r--spec/registration_spec.rb4
-rw-r--r--views/layout.erb2
3 files changed, 9 insertions, 1 deletions
diff --git a/lib/band.rb b/lib/band.rb
index 760274b..e75dd6e 100644
--- a/lib/band.rb
+++ b/lib/band.rb
@@ -45,4 +45,8 @@ class Band
errors << "Du må ha med minst én låt!"
end
end
+
+ def has_errors
+ errors.length > 0
+ end
end
diff --git a/spec/registration_spec.rb b/spec/registration_spec.rb
index 4b27bbe..db7db70 100644
--- a/spec/registration_spec.rb
+++ b/spec/registration_spec.rb
@@ -46,6 +46,10 @@ describe RegistrationApp do
expect(last_response).to be_ok
end
+ it 'should not display any errors' do
+ expect(last_response.body).not_to include("Det er feil i skjemaet")
+ end
+
it 'displays submitted data to user' do
expect(last_response).to match(/Bandnavn\: Imbalance/)
expect(last_response).to match(/Hjemsted\: Oslo/)
diff --git a/views/layout.erb b/views/layout.erb
index 8dd0c31..eb1d803 100644
--- a/views/layout.erb
+++ b/views/layout.erb
@@ -8,7 +8,7 @@
<title>Norsk Urskog 2015 - Påmeldingsskjema for band</title>
</head>
<body>
- <% if @band && @band.errors %>
+ <% if @band && @band.has_errors %>
<div class="error">
<h1 class="error-heading">Det er feil i skjemaet!</h1>
<p>Vennligst se over følgende og prøv igjen:</p>