Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
samnang committed Dec 17, 2024
1 parent 0f65600 commit d70c152
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions spec/models/contact_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@
it { is_expected.to allow_value("+252 66-(2)-345-678").for(:msisdn) }
end

describe "associations" do
it { is_expected.to have_many(:callout_participations).dependent(:restrict_with_error) }
it { is_expected.to have_many(:phone_calls).dependent(:restrict_with_error) }
end
describe "#assign_iso_country_code" do
it "assigns iso country code" do
beneficiary = create(:beneficiary, msisdn: "+85510999999", iso_country_code: nil)

expect(beneficiary.iso_country_code).to eq("KH")
end

it "preserves iso country code" do
beneficiary = create(:beneficiary, msisdn: "+85510999999", iso_country_code: "TH")

describe "delegations" do
it { is_expected.to delegate_method(:call_flow_logic).to(:account) }
expect(beneficiary.iso_country_code).to eq("TH")
end
end
end

0 comments on commit d70c152

Please sign in to comment.