-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
26 additions
and
26 deletions.
There are no files selected for viewing
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
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
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
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
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
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 |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
|
||
context 'uniqueness' do | ||
it 'requires a unique email address regardless of case' do | ||
existing_email = create(:email, email: '[email protected]') | ||
create(:email, email: '[email protected]') | ||
new_email = build(:email, email: '[email protected]') | ||
|
||
expect(new_email).not_to be_valid | ||
|
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 |
---|---|---|
|
@@ -12,9 +12,9 @@ | |
|
||
context "with valid parameters" do | ||
it "creates new imported members" do | ||
expect { | ||
expect do | ||
post admin_imported_members_path, params: { source: source, file: file } | ||
}.to change(ImportedMember, :count).by(2) | ||
end.to change(ImportedMember, :count).by(2) | ||
|
||
expect(response).to redirect_to(admin_imported_members_path) | ||
follow_redirect! | ||
|
@@ -45,9 +45,9 @@ | |
it "updates the existing imported member" do | ||
existing_member = create(:imported_member, email: '[email protected]', full_name: 'Old Name', data: { sources: ['old_source'] }) | ||
|
||
expect { | ||
expect do | ||
post admin_imported_members_path, params: { source: source, file: file } | ||
}.to change(ImportedMember, :count).by(1) | ||
end.to change(ImportedMember, :count).by(1) | ||
|
||
existing_member.reload | ||
expect(existing_member.full_name).to eq('Old Name') | ||
|
@@ -59,9 +59,9 @@ | |
it "skips the row" do | ||
create(:email, email: '[email protected]') | ||
|
||
expect { | ||
expect do | ||
post admin_imported_members_path, params: { source: source, file: file } | ||
}.to change(ImportedMember, :count).by(1) | ||
end.to change(ImportedMember, :count).by(1) | ||
|
||
expect(ImportedMember.find_by(email: '[email protected]')).to be_nil | ||
end | ||
|
@@ -71,9 +71,9 @@ | |
let(:file) { fixture_file_upload('imported_members_blank_email.csv', 'text/csv') } | ||
|
||
it "skips the row" do | ||
expect { | ||
expect do | ||
post admin_imported_members_path, params: { source: source, file: file } | ||
}.to change(ImportedMember, :count).by(1) | ||
end.to change(ImportedMember, :count).by(1) | ||
|
||
expect(ImportedMember.find_by(email: '')).to be_nil | ||
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
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
"Type" => "Subscribe", | ||
"EmailAddress" => user.email, | ||
"ListId" => list.api_id, | ||
}, | ||
} | ||
], | ||
}.to_json | ||
end | ||
|
@@ -36,7 +36,7 @@ | |
"Type" => "Deactivate", | ||
"EmailAddress" => user.email, | ||
"ListId" => list.api_id, | ||
}, | ||
} | ||
], | ||
}.to_json | ||
end | ||
|
@@ -72,7 +72,7 @@ | |
"Type" => "Subscribe", | ||
"EmailAddress" => "[email protected]", | ||
"ListId" => list.api_id, | ||
}, | ||
} | ||
], | ||
}.to_json | ||
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 |
---|---|---|
|
@@ -17,18 +17,18 @@ | |
describe "POST /create" do | ||
context "with valid parameters" do | ||
it "creates a new email and redirects to my_details_path" do | ||
expect { | ||
expect do | ||
post my_emails_path, params: { email: { email: "[email protected]" } } | ||
}.to change(Email, :count).by(1) | ||
end.to change(Email, :count).by(1) | ||
expect(response).to redirect_to(my_details_path) | ||
end | ||
end | ||
|
||
context "with invalid parameters" do | ||
it "re-renders the new template" do | ||
expect { | ||
expect do | ||
post my_emails_path, params: { email: { email: "" } } | ||
}.not_to change(Email, :count) | ||
end.not_to change(Email, :count) | ||
expect(response).to render_template(:new) | ||
end | ||
end | ||
|
@@ -51,9 +51,9 @@ | |
let!(:email) { create(:email, user: user) } | ||
|
||
it "deletes the specified email and redirects to my_details_path" do | ||
expect { | ||
expect do | ||
delete my_email_path(email) | ||
}.to change(Email, :count).by(-1) | ||
end.to change(Email, :count).by(-1) | ||
expect(response).to redirect_to(my_details_path) | ||
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