Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegate to MarriageAbroadDataQuery from MarriageAbroadCalculator #2346

Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
eb26cbf
Use multiple lines for long conditionals in marriage-abroad
chrisroos Feb 25, 2016
5b316c5
Remove unnecessary parenthesis
chrisroos Feb 25, 2016
5fc2335
Add #ceremony_country_is_french_overseas_territory?
chrisroos Feb 24, 2016
10e53fb
Add #opposite_sex_consular_cni_country?
chrisroos Feb 24, 2016
ec6de12
Add #opposite_sex_consular_cni_in_nearby_country?
chrisroos Feb 24, 2016
48cbaec
Add #opposite_sex_no_marriage_related_consular_services_in_ceremony_c…
chrisroos Feb 24, 2016
ff31e86
Add #opposite_sex_affirmation_country?
chrisroos Feb 24, 2016
5ce3c9b
Add #ceremony_country_in_the_commonwealth?
chrisroos Feb 24, 2016
6a8ecab
Add #ceremony_country_is_british_overseas_territory?
chrisroos Feb 24, 2016
fa0b2ff
Add #opposite_sex_no_consular_cni_country?
chrisroos Feb 24, 2016
7c3c6f5
Add #opposite_sex_marriage_via_local_authorities?
chrisroos Feb 24, 2016
b2449b5
Add #opposite_sex_in_other_countries?
chrisroos Feb 24, 2016
b7fca43
Add #same_sex_ceremony_country_unknown_or_has_no_embassies?
chrisroos Feb 24, 2016
7ffce09
Add #same_sex_marriage_not_possible?
chrisroos Feb 24, 2016
68cda9c
Add #same_sex_marriage_country?
chrisroos Feb 24, 2016
8d901a4
Add #same_sex_marriage_country_when_couple_british?
chrisroos Feb 24, 2016
a076dc5
Add #same_sex_marriage_and_civil_partnership?
chrisroos Feb 24, 2016
810ba28
Add #civil_partnership_equivalent_country?
chrisroos Feb 24, 2016
3b88207
Add #civil_partnership_cni_not_required_country?
chrisroos Feb 24, 2016
da23c04
Add #civil_partnership_consular_country?
chrisroos Feb 24, 2016
ddac80a
Add #country_without_consular_facilities?
chrisroos Feb 29, 2016
541a6a2
Add #opposite_sex_21_days_residency_required?
chrisroos Feb 29, 2016
1219b58
Add #ceremony_country_is_dutch_caribbean_island?
chrisroos Feb 29, 2016
8f83849
Add #requires_7_day_notice?
chrisroos Feb 29, 2016
0dbd941
Add #same_sex_alt_fees_table_country?
chrisroos Feb 29, 2016
cc35a83
Avoid passing data_query unnecessarily
chrisroos Feb 29, 2016
7fc0dec
Remove data_query from marriage-abroad flow
chrisroos Feb 29, 2016
021d901
Update checksum data for marriage-abroad
chrisroos Feb 29, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add #ceremony_country_in_the_commonwealth?
I want the `MarriageAbroadCalculator` to encapsulate all the logic
required by the flow and views. Delegating to the
`MarriageAbroadDataQuery` for this method is a step toward that goal.

Interestingly we have another, different, concept of Commonwealth
countries in `RegistrationsDataQuery`. I've made a separate note to
investigate that.
chrisroos committed Mar 8, 2016
commit 5ce3c9b177e28b8ecd2bc2481500423419af380b
4 changes: 4 additions & 0 deletions lib/smart_answer/calculators/marriage_abroad_calculator.rb
Original file line number Diff line number Diff line change
@@ -151,5 +151,9 @@ def opposite_sex_no_marriage_related_consular_services_in_ceremony_country?
def opposite_sex_affirmation_country?
@data_query.os_affirmation_countries?(ceremony_country)
end

def ceremony_country_in_the_commonwealth?
@data_query.commonwealth_country?(ceremony_country)
end
end
end
2 changes: 1 addition & 1 deletion lib/smart_answer_flows/marriage-abroad.rb
Original file line number Diff line number Diff line change
@@ -211,7 +211,7 @@ def define
:outcome_os_consular_cni
elsif calculator.opposite_sex_affirmation_country?
:outcome_os_affirmation
elsif data_query.commonwealth_country?(calculator.ceremony_country) ||
elsif calculator.ceremony_country_in_the_commonwealth? ||
calculator.ceremony_country == 'zimbabwe'
:outcome_os_commonwealth
elsif data_query.british_overseas_territories?(calculator.ceremony_country)
11 changes: 11 additions & 0 deletions test/unit/calculators/marriage_abroad_calculator_test.rb
Original file line number Diff line number Diff line change
@@ -524,6 +524,17 @@ class MarriageAbroadCalculatorTest < ActiveSupport::TestCase
assert_equal 'opposite-sex-affirmation-country', calculator.opposite_sex_affirmation_country?
end
end

context '#ceremony_country_in_the_commonwealth' do
should 'delegate to the data query' do
data_query = stub.quacks_like(MarriageAbroadDataQuery.new)
data_query.stubs(:commonwealth_country?).with('ceremony-country').returns('commonwealth-country')
calculator = MarriageAbroadCalculator.new(data_query: data_query)
calculator.ceremony_country = 'ceremony-country'

assert_equal 'commonwealth-country', calculator.ceremony_country_in_the_commonwealth?
end
end
end
end
end