-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into API-42322-Extract-OrgWebServiceBean-from-l…
…ocalBGS
- Loading branch information
Showing
8 changed files
with
56 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
require_relative '../support/shared_examples_for_base_form' | ||
|
||
RSpec.describe SimpleFormsApi::VBA210845 do | ||
describe 'zip_code_is_us_based' do | ||
subject(:zip_code_is_us_based) { described_class.new(data).zip_code_is_us_based } | ||
|
||
context 'authorizer address is present and in US' do | ||
let(:data) { { 'authorizer_address' => { 'country' => 'USA' } } } | ||
|
||
it 'returns true' do | ||
expect(zip_code_is_us_based).to eq(true) | ||
end | ||
end | ||
|
||
context 'authorizer address is present and not in US' do | ||
let(:data) { { 'authorizer_address' => { 'country' => 'Canada' } } } | ||
|
||
it 'returns false' do | ||
expect(zip_code_is_us_based).to eq(false) | ||
end | ||
end | ||
|
||
context 'person is present and in US' do | ||
let(:data) { { 'person_address' => { 'country' => 'USA' } } } | ||
|
||
it 'returns true' do | ||
expect(zip_code_is_us_based).to eq(true) | ||
end | ||
end | ||
|
||
context 'person is present and not in US' do | ||
let(:data) { { 'person_address' => { 'country' => 'Canada' } } } | ||
|
||
it 'returns false' do | ||
expect(zip_code_is_us_based).to eq(false) | ||
end | ||
end | ||
|
||
context 'organization is present and in US' do | ||
let(:data) do | ||
{ 'organization_address' => { 'country' => 'USA' } } | ||
end | ||
|
||
it 'returns true' do | ||
expect(zip_code_is_us_based).to eq(true) | ||
end | ||
end | ||
|
||
context 'organization is present and not in US' do | ||
let(:data) do | ||
{ 'organization_address' => { 'country' => 'Canada' } } | ||
end | ||
|
||
it 'returns false' do | ||
expect(zip_code_is_us_based).to eq(false) | ||
end | ||
end | ||
|
||
context 'no valid address is given' do | ||
let(:data) { {} } | ||
|
||
it 'returns false' do | ||
expect(zip_code_is_us_based).to eq(false) | ||
end | ||
end | ||
end | ||
it_behaves_like 'zip_code_is_us_based', %w[authorizer_address person_address organization_address] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
modules/simple_forms_api/spec/support/shared_examples_for_base_form.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.shared_examples 'zip_code_is_us_based' do |address_keys| | ||
subject(:zip_code_is_us_based) { described_class.new(data).zip_code_is_us_based } | ||
|
||
address_keys.each do |address_key| | ||
context 'address is present and in US' do | ||
let(:data) { { address_key => { 'country' => 'USA' } } } | ||
|
||
it 'returns true' do | ||
expect(zip_code_is_us_based).to eq(true) | ||
end | ||
end | ||
|
||
context 'address is present and not in US' do | ||
let(:data) { { address_key => { 'country' => 'Canada' } } } | ||
|
||
it 'returns false' do | ||
expect(zip_code_is_us_based).to eq(false) | ||
end | ||
end | ||
end | ||
|
||
context 'no valid address is given' do | ||
let(:data) { {} } | ||
|
||
it 'returns false' do | ||
expect(zip_code_is_us_based).to eq(false) | ||
end | ||
end | ||
end |