Skip to content

Commit

Permalink
update test to use be_valid
Browse files Browse the repository at this point in the history
  • Loading branch information
panacotar committed Sep 13, 2024
1 parent d21aed3 commit bd72060
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/models/partners/profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,28 +198,28 @@
context "number of email addresses" do
let(:profile) { build(:partner_profile, pick_up_email: "pick_up@org.com, pick_up2@org.com, pick_up3@org.com, pick_up4@org.com") }
it "should not allow more than three email addresses" do
expect(profile.valid?).to eq(false)
expect(profile).to_not be_valid
profile.update(pick_up_email: "pick_up@org.com, pick_up2@org.com, pick_up3@org.com")
expect(profile.valid?).to eq(true)
expect(profile).to be_valid
end

it "should not allow repeated email addresses" do
profile.update(pick_up_email: "pick_up@org.com, pick_up2@org.com, pick_up@org.com")
expect(profile.valid?).to eq(false)
expect(profile).to_not be_valid
end
end

context "invalid emails" do
let(:profile) { build(:partner_profile, pick_up_email: "pick_up@org.com, pick_up2@org.com, asdf") }
it "should not allow invalid email addresses" do
expect(profile.valid?).to eq(false)
expect(profile).to_not be_valid
profile.update(pick_up_email: "pick_up@org.com, pick_up2@org.com")
expect(profile.valid?).to eq(true)
expect(profile).to be_valid
end

it "should handle nil value" do
profile.update(pick_up_email: nil)
expect(profile.valid?).to eq(true)
expect(profile).to be_valid
end
end
end
Expand Down

0 comments on commit bd72060

Please sign in to comment.