Skip to content

Commit

Permalink
Split integration spec file in two
Browse files Browse the repository at this point in the history
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
equivalentideas committed Aug 2, 2017
1 parent 8a04ea2 commit 74466ea
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 35 deletions.
@@ -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: "jane@contributor.com"
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
35 changes: 0 additions & 35 deletions spec/features/user_contributes_new_councillor_spec.rb
Expand Up @@ -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: "mgilic@casey.vic.gov.au"
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: "jane@contributor.com"
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: "mgilic@casey.vic.gov.au"
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)

Expand Down

0 comments on commit 74466ea

Please sign in to comment.