Skip to content

Commit

Permalink
Rails 6.0 Active Storage compatibility for tests
Browse files Browse the repository at this point in the history
* Make service_name nullable because it does not exist in 6.0.
* Make the download URL assertion compatible with the 6.0 download URLs.

Co-authored-by: Adrianna Chang <[email protected]>
  • Loading branch information
etiennebarrie and adrianna-chang-shopify committed Mar 31, 2021
1 parent cd700ab commit b5892f8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def change
t.string(:filename, null: false)
t.string(:content_type)
t.text(:metadata)
t.string(:service_name, null: false)
t.string(:service_name, null: true)
t.bigint(:byte_size, null: false)
t.string(:checksum, null: false)
t.datetime(:created_at, null: false)
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
t.string "filename", null: false
t.string "content_type"
t.text "metadata"
t.string "service_name", null: false
t.string "service_name"
t.bigint "byte_size", null: false
t.string "checksum", null: false
t.datetime "created_at", null: false
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/maintenance_tasks/tasks_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class TasksHelperTest < ActionView::TestCase
csv = Rack::Test::UploadedFile.new(file_fixture("sample.csv"), "text/csv")
run.csv_file.attach(csv)

assert_match %r{rails\/active_storage\/blobs\/redirect\/\S+\/sample.csv},
assert_match %r{rails/active_storage/blobs/\S+/sample.csv},
csv_file_download_path(run)
end
end
Expand Down

0 comments on commit b5892f8

Please sign in to comment.