Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit c954a2a

Browse files
committed
creating model tests for postal address
1 parent 7964bb7 commit c954a2a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

spec/models/postal_address_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require 'rails_helper'
2+
3+
RSpec.describe PostalAddress, type: :model do
4+
describe 'associations' do
5+
it { is_expected.to belong_to(:user) }
6+
end
7+
8+
describe 'validations' do
9+
it { should_validate_presence_of(:address_line_1)}
10+
it { should_validate_presence_of(:city)}
11+
it { should_validate_presence_of(:postal_code)}
12+
it { should_validate_presence_of(:country)}
13+
end
14+
end

spec/models/user_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
it { is_expected.to have_many(:applications).through(:teams) }
1313
it { is_expected.to have_many(:todos).dependent(:destroy) }
1414
it { is_expected.to have_many(:comments).dependent(:destroy) }
15+
it { is_expected.to have_one(:postal_address).dependent(:destroy) }
1516
end
1617

1718
describe 'validations' do

0 commit comments

Comments
 (0)