all fields are required
This commit is contained in:
@@ -18,3 +18,8 @@
|
||||
|
||||
body
|
||||
padding-top: 20px
|
||||
|
||||
#new_supporter
|
||||
label.required
|
||||
abbr
|
||||
display: none
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user