clarion/spec/features/call_for_papers_spec.rb

129 lines
3.9 KiB
Ruby
Raw Permalink Normal View History

2018-11-11 00:07:00 +02:00
require "rails_helper"
2019-04-28 21:10:54 +03:00
feature "Call for papers" do
2018-11-11 00:07:00 +02:00
before do
Rails.application.load_seed
end
scenario "A new user submits an event proposition" do
sign_in_as_admin
create_new_conference
sign_out
visit root_path
2019-04-28 21:10:54 +03:00
click_on I18n.t("views.welcome.submit_event", event_type: Conference.first.event_types.first.name.try(:mb_chars).try(:downcase))
2018-11-11 00:07:00 +02:00
click_on I18n.t(:registration)
register_a_new_user(false)
submit_an_event_proposition
2019-04-28 21:10:54 +03:00
expect(page).to have_content I18n.t("views.events.event_successfully_created", event_type: Event.last.event_type.name.mb_chars.downcase)
2018-11-11 00:07:00 +02:00
expect(page).to have_content I18n.t(:please_fill_in_your_speaker_profile)
fill_in_personal_profile
2019-04-28 21:10:54 +03:00
expect(page).to have_content I18n.t("views.personal_profiles.successfully_created")
2018-11-11 00:07:00 +02:00
2019-04-28 21:10:54 +03:00
click_on I18n.t("views.navigation.my_submissions")
2018-11-11 00:07:00 +02:00
expect(page).to have_content(Event.last.event_type.name + ' "This is just a sample title of an event"')
sign_out
verify_the_event_is_submitted
end
scenario "A returning user submits an event proposition" do
time_travel_to(2.years.ago) do
sign_in_as_admin
create_new_conference
sign_out
visit root_path
2019-04-28 21:10:54 +03:00
click_on I18n.t("views.welcome.submit_event", event_type: Conference.first.event_types.first.name.try(:mb_chars).try(:downcase))
2018-11-11 00:07:00 +02:00
click_on I18n.t(:registration)
register_a_new_user(false)
submit_an_event_proposition
fill_in_personal_profile
sign_out
end
sign_in_as_admin
create_new_conference
sign_out
visit root_path
2019-04-28 21:10:54 +03:00
click_on I18n.t("views.welcome.submit_event", event_type: Conference.first.event_types.first.name.try(:mb_chars).try(:downcase))
2018-11-11 00:07:00 +02:00
sign_in_as_an_existing_user(false)
submit_an_event_proposition(false)
expect(page).to have_content I18n.t(:please_fill_in_your_speaker_profile)
2019-04-28 21:10:54 +03:00
click_on I18n.t("helpers.submit.create", model: PersonalProfile.model_name.human)
2018-11-11 00:07:00 +02:00
2019-04-28 21:10:54 +03:00
expect(page).to have_content I18n.t("views.personal_profiles.successfully_created")
2018-11-11 00:07:00 +02:00
2019-04-28 21:10:54 +03:00
click_on I18n.t("views.navigation.my_submissions")
2018-11-11 00:07:00 +02:00
expect(page).to have_content(Event.last.event_type.name + ' "This is just a sample title of an event"')
sign_out
verify_the_event_is_submitted
end
scenario "A returning user resets their password and submits an event proposition" do
time_travel_to(2.years.ago) do
sign_in_as_admin
create_new_conference
sign_out
visit root_path
2019-04-28 21:10:54 +03:00
click_on I18n.t("views.welcome.submit_event", event_type: Conference.first.event_types.first.name.try(:mb_chars).try(:downcase))
2018-11-11 00:07:00 +02:00
click_on I18n.t(:registration)
register_a_new_user(false)
submit_an_event_proposition
fill_in_personal_profile
sign_out
end
sign_in_as_admin
create_new_conference
sign_out
visit root_path
2019-04-28 21:10:54 +03:00
click_on I18n.t("views.welcome.submit_event", event_type: Conference.first.event_types.first.name.try(:mb_chars).try(:downcase))
2018-11-11 00:07:00 +02:00
2019-04-28 21:10:54 +03:00
click_on I18n.t("lostpass")
fill_in User.human_attribute_name(:email), with: "bar@example.com"
2018-11-11 00:07:00 +02:00
click_on I18n.t(:send_lostpass_instructions)
2019-04-28 21:10:54 +03:00
expect(page).to have_content I18n.t("devise.passwords.send_instructions")
2018-11-11 00:07:00 +02:00
visit ActionMailer::Base.deliveries.last.body.raw_source.match(/https?:\/\/.*?(\/.*\w)/)[1]
2019-04-28 21:10:54 +03:00
fill_in User.human_attribute_name(:password), with: "foobarbaz"
fill_in User.human_attribute_name(:password_confirmation), with: "foobarbaz"
2018-11-11 00:07:00 +02:00
click_on I18n.t(:change_pass)
submit_an_event_proposition(false)
expect(page).to have_content I18n.t(:please_fill_in_your_speaker_profile)
2019-04-28 21:10:54 +03:00
click_on I18n.t("helpers.submit.create", model: PersonalProfile.model_name.human)
2018-11-11 00:07:00 +02:00
2019-04-28 21:10:54 +03:00
expect(page).to have_content I18n.t("views.personal_profiles.successfully_created")
2018-11-11 00:07:00 +02:00
2019-04-28 21:10:54 +03:00
click_on I18n.t("views.navigation.my_submissions")
2018-11-11 00:07:00 +02:00
expect(page).to have_content(Event.last.event_type.name + ' "This is just a sample title of an event"')
sign_out
verify_the_event_is_submitted
end
end