-
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 #8520 from alphagov/use-asset-id-for-consultationr…
…esponseformdata Use asset-id for for consultation_response_form_data
- Loading branch information
Showing
17 changed files
with
169 additions
and
106 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
FactoryBot.define do | ||
factory :consultation_response_form_data do | ||
file { File.open(Rails.root.join("test/fixtures/two-pages.pdf")) } | ||
|
||
after(:build) do |consultation_response_form_data| | ||
consultation_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
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 |
---|---|---|
|
@@ -282,10 +282,26 @@ class OpenConsultationWithParticipationTest < TestCase | |
|
||
test "ways to respond" do | ||
Plek.any_instance.stubs(:asset_root).returns("https://asset-host.com") | ||
expected_id = @participation.consultation_response_form.consultation_response_form_data.id | ||
expected_filename = @participation.consultation_response_form.consultation_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 consultation response form asset is missing" do | ||
@participation.consultation_response_form.consultation_response_form_data.assets = [] | ||
expected_ways_to_respond = { | ||
attachment_url: "https://asset-host.com/government/uploads/system/uploads/consultation_response_form_data/file/#{expected_id}/#{expected_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
Oops, something went wrong.