-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This creates a new file that covers the different options for contribution for providing their information to us. We split this out to make the original spec file more focused and easier to understand. This now means there isn't a single spec for working through the whole contribution process from beginning to end. But we think that's ok for now, because the contribution and the stage of providing details are quite separate.
- Loading branch information
1 parent
8a04ea2
commit 74466ea
Showing
2 changed files
with
44 additions
and
35 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
spec/features/contributor_can_provide_their_contact_details_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require "spec_helper" | ||
|
||
feature "Contributor can contribute their contact information" do | ||
context "when the feature flag is off" do | ||
it "isn't available" do | ||
visit new_contributor_path | ||
|
||
expect(page.status_code).to eq 404 | ||
end | ||
end | ||
|
||
context "when the feature flag is on" do | ||
around do |test| | ||
with_modified_env CONTRIBUTE_COUNCILLORS_ENABLED: "true" do | ||
test.run | ||
end | ||
end | ||
|
||
before :each do | ||
CouncillorContribution.new(id: 1).save | ||
end | ||
|
||
it "successfully" do | ||
visit new_contributor_path(councillor_contribution_id: 1) | ||
|
||
within_fieldset "Please tell us about yourself, so we can send you a little note of appreciation and updates about your contribution when it goes live." do | ||
fill_in "Name", with: "Jane Contributes" | ||
fill_in "Email", with: "[email protected]" | ||
end | ||
|
||
click_button "Submit" | ||
|
||
expect(page).to have_content "Thank you" | ||
end | ||
|
||
it "or not if they choose" do | ||
visit new_contributor_path(councillor_contribution_id: 1) | ||
|
||
click_link "I prefer not to" | ||
|
||
expect(page).to have_content "Thank you" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,41 +18,6 @@ | |
end | ||
end | ||
|
||
it "after landing on the contribution page, works successfully when the contributor provides their information" do | ||
visit new_authority_councillor_contribution_path(authority.short_name_encoded) | ||
|
||
within ".councillor-contribution-councillors fieldset" do | ||
fill_in "Full name", with: "Mila Gilic" | ||
fill_in "Email", with: "[email protected]" | ||
end | ||
|
||
click_button "Submit 1 new councillor" | ||
|
||
within_fieldset "Please tell us about yourself, so we can send you a little note of appreciation and updates about your contribution when it goes live." do | ||
fill_in "Name", with: "Jane Contributes" | ||
fill_in "Email", with: "[email protected]" | ||
end | ||
|
||
click_button "Submit" | ||
|
||
expect(page).to have_content "Thank you" | ||
end | ||
|
||
it "works successfully when the contributor does not provide their information" do | ||
visit new_authority_councillor_contribution_path(authority.short_name_encoded) | ||
|
||
within ".councillor-contribution-councillors fieldset" do | ||
fill_in "Full name", with: "Mila Gilic" | ||
fill_in "Email", with: "[email protected]" | ||
end | ||
|
||
click_button "Submit 1 new councillor" | ||
|
||
click_link "I prefer not to" | ||
|
||
expect(page).to have_content "Thank you" | ||
end | ||
|
||
it "successfully with three councillors and one blank councillor" do | ||
visit new_authority_councillor_contribution_path(authority.short_name_encoded) | ||
|
||
|