Skip to content

Commit

Permalink
remove context wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusPirvulescu committed Sep 15, 2024
1 parent 92ac8fb commit 1fb21ab
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions spec/models/partners/profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,28 +169,26 @@

describe "split pick up email" do
let(:profile) { build(:partner_profile, pick_up_email: "pick_up@org.com, pick_up2@org.com") }
context "should handle different inputs" do
it "should disregard commas at the beginning or end of the string" do
profile.update(pick_up_email: ", pick_up@org.com, pick_up2@org.com,")
expect(profile.split_pick_up_emails).to match_array(["pick_up@org.com", "pick_up2@org.com"])
end
it "should disregard commas at the beginning or end of the string" do
profile.update(pick_up_email: ", pick_up@org.com, pick_up2@org.com,")
expect(profile.split_pick_up_emails).to match_array(["pick_up@org.com", "pick_up2@org.com"])
end

it "should allow optional whitespace between email addresses" do
profile.update(pick_up_email: "pick_up@org.com, pick_up2@org.com")
expect(profile.split_pick_up_emails).to match_array(["pick_up@org.com", "pick_up2@org.com"])
profile.update(pick_up_email: "pick_up@org.com,pick_up2@org.com")
expect(profile.split_pick_up_emails).to match_array(["pick_up@org.com", "pick_up2@org.com"])
end
it "should allow optional whitespace between email addresses" do
profile.update(pick_up_email: "pick_up@org.com, pick_up2@org.com")
expect(profile.split_pick_up_emails).to match_array(["pick_up@org.com", "pick_up2@org.com"])
profile.update(pick_up_email: "pick_up@org.com,pick_up2@org.com")
expect(profile.split_pick_up_emails).to match_array(["pick_up@org.com", "pick_up2@org.com"])
end

it "should handle nil value" do
profile.update(pick_up_email: nil)
expect(profile.split_pick_up_emails).to be_nil
end
it "should handle nil value" do
profile.update(pick_up_email: nil)
expect(profile.split_pick_up_emails).to be_nil
end

it "should return empty array if for when pick_up_email is an empty string" do
profile.update(pick_up_email: "")
expect(profile.split_pick_up_emails).to match_array([])
end
it "should return empty array if for when pick_up_email is an empty string" do
profile.update(pick_up_email: "")
expect(profile.split_pick_up_emails).to match_array([])
end
end

Expand Down

0 comments on commit 1fb21ab

Please sign in to comment.