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_is_french_overseas_territory?
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.
chrisroos committed Mar 8, 2016
commit 5fc23352d88e3a0b66d67269c402c91d8030727c
6 changes: 5 additions & 1 deletion lib/smart_answer/calculators/marriage_abroad_calculator.rb
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ def country_name_uppercase_prefix
def country_name_partner_residence
if @data_query.british_overseas_territories?(ceremony_country)
'British (overseas territories citizen)'
elsif @data_query.french_overseas_territories?(ceremony_country)
elsif ceremony_country_is_french_overseas_territory?
'French'
elsif @data_query.dutch_caribbean_islands?(ceremony_country)
'Dutch'
@@ -131,5 +131,9 @@ def embassy_or_consulate_ceremony_country
'embassy'
end
end

def ceremony_country_is_french_overseas_territory?
@data_query.french_overseas_territories?(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
@@ -36,7 +36,7 @@ def define
:partner_opposite_or_same_sex?
elsif %w(france monaco new-caledonia wallis-and-futuna).include?(calculator.ceremony_country)
:marriage_or_pacs?
elsif data_query.french_overseas_territories?(calculator.ceremony_country)
elsif calculator.ceremony_country_is_french_overseas_territory?
:outcome_os_france_or_fot
else
:legal_residency?
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
<% end %>

<% content_for :body do %>
<% if data_query.french_overseas_territories?(calculator.ceremony_country) %>
<% if calculator.ceremony_country_is_french_overseas_territory? %>
<%= calculator.country_name_uppercase_prefix %> is an overseas department or territory of France. The rules and requirements for getting married there are similar to France.
<% end %>

11 changes: 11 additions & 0 deletions test/unit/calculators/marriage_abroad_calculator_test.rb
Original file line number Diff line number Diff line change
@@ -469,6 +469,17 @@ class MarriageAbroadCalculatorTest < ActiveSupport::TestCase
assert_equal 'embassy', @calculator.embassy_or_consulate_ceremony_country
end
end

context '#ceremony_country_is_french_overseas_territory?' do
should 'delegate to the data query' do
data_query = stub.quacks_like(MarriageAbroadDataQuery.new)
data_query.stubs(:french_overseas_territories?).with('ceremony-country').returns('french-overseas-territory')
calculator = MarriageAbroadCalculator.new(data_query: data_query)
calculator.ceremony_country = 'ceremony-country'

assert_equal 'french-overseas-territory', calculator.ceremony_country_is_french_overseas_territory?
end
end
end
end
end