all fields are required

This commit is contained in:
2015-10-06 09:30:35 +02:00
parent b381cbf066
commit 9bdb99fe3d
5 changed files with 18 additions and 3 deletions
+5
View File
@@ -18,3 +18,8 @@
body
padding-top: 20px
#new_supporter
label.required
abbr
display: none
+1 -1
View File
@@ -18,6 +18,6 @@ class SupportersController < ApplicationController
private
def supporter_form_params
params.require(:supporter).permit(:first_name, :last_name, :street, :zip, :email, :support, :age_category)
params.require(:supporter).permit(:first_name, :last_name, :street, :zip, :email, :support, :age_category, :city)
end
end
+5
View File
@@ -11,6 +11,11 @@ class Supporter
field :support, type: String # Indicates the type of support
field :age_category, type: String
validates :first_name, presence: true
validates :last_name, presence: true
validates :street, presence: true
validates :zip, presence: true
validates :city, presence: true
validates :email, presence: true, uniqueness: true
validates :support, presence: true
validates :age_category, presence: true
+1 -2
View File
@@ -11,7 +11,6 @@ feature 'Support announcement' do
fill_in 'Postleitzahl', with: '8704'
fill_in 'Ort', with: 'Hinterm Mond'
fill_in 'E-Mail', with: 'blocher@blocher.ch'
fill_in 'E-Mail', with: 'blocher@blocher.ch'
choose 'Ich unterschreibe eine Volksinitiative für die Freigabe von Cannabis und helfe aktiv Unterschriften in meiner Umgebung zu sammeln.'
@@ -26,7 +25,7 @@ feature 'Support announcement' do
click_button 'Unterstützung zusichern'
expect(page).to have_content 'Ihre Eingabe war zu schnell.'
# Test twice just to be sure that it's not become an update action
click_button 'Unterstützung zusichern'
+6
View File
@@ -1,7 +1,13 @@
require 'rails_helper'
describe Supporter do
it { is_expected.to validate_presence_of(:first_name) }
it { is_expected.to validate_presence_of(:last_name) }
it { is_expected.to validate_presence_of(:street) }
it { is_expected.to validate_presence_of(:zip) }
it { is_expected.to validate_presence_of(:city) }
it { is_expected.to validate_presence_of(:email) }
it { is_expected.to validate_uniqueness_of(:email) }
it { is_expected.to validate_presence_of(:support) }
it { is_expected.to validate_presence_of(:age_category) }
end