This repository was archived by the owner on Jun 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 113113 = pa.input :address_line_2 , required: false
114114 = pa.input :city , required: false
115115 = pa.input :state_or_province , required: false
116+ = pa.input :postal_code , required: false
116117 = pa.input :country , required: false
117118
118119
Original file line number Diff line number Diff line change 1+ FactoryBot . define do
2+ factory :postal_address do
3+ user
4+ address_line_1 { FFaker ::AddressUS . street_address }
5+ address_line_2 { FFaker ::AddressUS . secondary_address }
6+ city { FFaker ::AddressUS . city }
7+ state_or_province { FFaker ::AddressUS . state }
8+ postal_code { FFaker ::AddressUS . zip_code }
9+ country { FFaker ::AddressUS . country }
10+ end
11+ end
Original file line number Diff line number Diff line change 1+ require 'rails_helper'
2+
3+ RSpec . describe 'Add Postal Address' , type : :feature do
4+ let ( :user ) { create ( :user ) }
5+ let ( :address ) { create ( :postal_address ) }
6+
7+ context 'signed in' do
8+ before { sign_in user }
9+
10+ context 'in the user edit page' do
11+ before { visit edit_user_path ( user ) }
12+
13+ it 'allows creation of postal address if all required address fields are entered' do
14+ fill_in 'user_postal_addresses_address_line_1' , with : address . address_line_1
15+ fill_in 'user_postal_addresses_address_line_2' , with : address . address_line_2
16+ fill_in 'user_postal_addresses_city' , with : address . city
17+ fill_in 'user_postal_addresses_state_or_province' , with : address . state_or_province
18+ fill_in 'user_postal_addresses_postal_code' , with : address . postal_code
19+ select address . country , from : 'user_postal_addresses_country'
20+ click_on 'Save'
21+
22+ expect ( current_path ) . to eq user_path ( user )
23+
24+ expect ( page ) . to have_content address . address_line_1
25+ expect ( page ) . to have_content address . address_line_2
26+ expect ( page ) . to have_content address . city
27+ expect ( page ) . to have_content address . state_or_province
28+ expect ( page ) . to have_content address . postal_code
29+ expect ( page ) . to have_content address . country
30+ end
31+ end
32+ end
33+ end
You can’t perform that action at this time.
0 commit comments