-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8542 from alphagov/use-asset-id-for-callforevidence
Use asset-id for for call_for_evidence_response_form_data
- Loading branch information
Showing
16 changed files
with
167 additions
and
33 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
FactoryBot.define do | ||
factory :call_for_evidence_response_form_data do | ||
file { File.open(Rails.root.join("test/fixtures/two-pages.pdf")) } | ||
|
||
after(:build) do |call_for_evidence_response_form_data| | ||
call_for_evidence_response_form_data.assets << build(:asset, asset_manager_id: "asset_manager_id_original", variant: Asset.variants[:original], filename: "two-pages.pdf") | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -281,10 +281,28 @@ class OpenCallForEvidenceWithParticipationTest < TestCase | |
|
||
test "ways to respond" do | ||
Plek.any_instance.stubs(:asset_root).returns("https://asset-host.com") | ||
expected_id = @participation.call_for_evidence_response_form.call_for_evidence_response_form_data.id | ||
filename = @participation.call_for_evidence_response_form.call_for_evidence_response_form_data.carrierwave_file | ||
|
||
expected_ways_to_respond = { | ||
attachment_url: "https://asset-host.com/media/asset_manager_id_original/two-pages.pdf", | ||
email: "[email protected]", | ||
link_url: "http://www.example.com", | ||
postal_address: <<-ADDRESS.strip_heredoc.chop, | ||
2 Home Farm Ln | ||
Kirklington | ||
Newark | ||
NG22 8PE | ||
UK | ||
ADDRESS | ||
} | ||
|
||
assert_details_attribute :ways_to_respond, expected_ways_to_respond | ||
end | ||
|
||
test "ways to respond: filters out 'attachment_url' when call for evidence response form asset is missing" do | ||
Plek.any_instance.stubs(:asset_root).returns("https://asset-host.com") | ||
@participation.call_for_evidence_response_form.call_for_evidence_response_form_data.assets = [] | ||
|
||
expected_ways_to_respond = { | ||
attachment_url: "https://asset-host.com/government/uploads/system/uploads/call_for_evidence_response_form_data/file/#{expected_id}/#{filename}", | ||
email: "[email protected]", | ||
link_url: "http://www.example.com", | ||
postal_address: <<-ADDRESS.strip_heredoc.chop, | ||
|
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