Introduce a Volunteering feature spec

This commit is contained in:
Petko Bordjukov 2019-01-08 00:20:31 +02:00
parent 657c760737
commit a784c4b45a
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,18 @@
require "rails_helper"
feature 'Volunteering' do
before do
Rails.application.load_seed
sign_in_as_admin
create_new_conference
sign_out
end
scenario 'A user applies to be a volunteer for the upcoming conference' do
visit root_path
click_on I18n.t('views.volunteers.apply')
fill_in_volunteer_profile
expect(page).to have_content I18n.t('views.volunteers.successful_application')
end
end

View File

@ -111,6 +111,16 @@ module FeatureHelpers
click_on I18n.t('helpers.submit.create', model: PersonalProfile.model_name.human) click_on I18n.t('helpers.submit.create', model: PersonalProfile.model_name.human)
end end
def fill_in_volunteer_profile
attach_file Volunteer.human_attribute_name(:picture), Rails.root.join('spec', 'support', 'picture.jpg')
fill_in Volunteer.human_attribute_name(:name), with: 'Foo'
fill_in Volunteer.human_attribute_name(:email), with: 'foo@example.com'
fill_in Volunteer.human_attribute_name(:phone), with: '+359666666'
check VolunteerTeam.first.name
click_on I18n.t('helpers.submit.volunteer.create')
end
def verify_the_event_is_submitted def verify_the_event_is_submitted
sign_in_as_admin sign_in_as_admin
click_on I18n.t('actions.view.button', model: Conference.model_name.human), match: :first click_on I18n.t('actions.view.button', model: Conference.model_name.human), match: :first