Skip to content

Commit

Permalink
Merge pull request #1945 from trade-tariff/GL-909
Browse files Browse the repository at this point in the history
GL-909: Extend categorisation function to account for GB specific measures
  • Loading branch information
willfish authored Aug 9, 2024
2 parents 287c861 + 546bd8a commit 15fccac
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def present_assessment(assessment, key, measure_permutation)
def filter_by_geographical_area(measure)
return true if @geographical_area_id.blank?

measure.relevant_for_country? @geographical_area_id
measure.relevant_for_country?(@geographical_area_id) || measure.relevant_for_country?('GB')
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,41 @@
end
end
end

context 'with default GB measures for category assessments' do
before do
gb = create(:geographical_area, geographical_area_id: 'GB')

gbm = create(:measure,
:with_base_regulation,
goods_nomenclature:,
for_geo_area: gb)
measures << gbm

category_assessments << create(:category_assessment, measure: gbm)
end

let(:geographical_area_id) { countries[:switzerland].geographical_area_id }

it { is_expected.to have_attributes length: 4 }

context 'for swiss assessment' do
subject { presented_assessments[category_assessments[0].id].first }

it { is_expected.to have_attributes measure_ids: [measures[0].measure_sid] }
end

context 'for erga omnes assessment' do
subject { presented_assessments[category_assessments[2].id].first }

it { is_expected.to have_attributes measure_ids: [measures[2].measure_sid] }
end

context 'for gb assessment' do
subject { presented_assessments[category_assessments[3].id].first }

it { is_expected.to have_attributes measure_ids: [measures[3].measure_sid] }
end
end
end
end

0 comments on commit 15fccac

Please sign in to comment.