Files
ch420/spec/features/support_spec.rb
T

36 lines
1.1 KiB
Ruby
Raw Normal View History

2015-10-05 12:40:08 +02:00
require 'rails_helper'
feature 'Support announcement' do
scenario 'User announces support' do
2015-10-06 09:16:07 +02:00
allow_any_instance_of(SupportersController).to receive(:input_to_fast?).and_return(false)
2015-10-05 12:40:08 +02:00
visit root_path
fill_in 'Vorname', with: 'Christoph'
fill_in 'Nachname', with: 'Blocher'
2015-10-05 14:10:07 +02:00
fill_in 'Strasse/Nr.', with: 'Wängirain 53'
2015-10-05 12:40:08 +02:00
fill_in 'Postleitzahl', with: '8704'
2015-10-05 14:12:05 +02:00
fill_in 'Ort', with: 'Hinterm Mond'
2015-10-05 12:40:08 +02:00
fill_in 'E-Mail', with: 'blocher@blocher.ch'
fill_in 'E-Mail', with: 'blocher@blocher.ch'
2015-10-05 14:10:07 +02:00
choose 'Ich unterschreibe eine Volksinitiative für die Freigabe von Cannabis und helfe aktiv Unterschriften in meiner Umgebung zu sammeln.'
2015-10-05 12:40:08 +02:00
choose 'Ich bin über 64 Jahre alt'
expect { click_button 'Unterstützung zusichern' }.to change { Supporter.count }.by(1)
end
2015-10-06 09:16:07 +02:00
scenario 'A bot tries to enter data' do
visit root_path
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'
expect(page).to have_content 'Ihre Eingabe war zu schnell.'
end
2015-10-05 12:40:08 +02:00
end