Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ on:
- synchronize
jobs:
ci:
runs-on: ubuntu-latest
runs-on: ${{ matrix.runner }}
strategy:
matrix:
# Ruby 3.1 is unavailable on Ubuntu 26.04 (ubuntu-latest).
runner: [ubuntu-24.04, ubuntu-24.04-arm]
ruby:
- "3.1"
- "3.2"
Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_transloadit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
_(step).must_be_kind_of Transloadit::Step
_(step.name).must_equal "resize"
_(step.robot).must_equal "/image/resize"
_(step.options).must_equal width: 320
_(step.options).must_equal({width: 320})
end

it "must create assembly api instances" do
Expand Down
8 changes: 4 additions & 4 deletions test/unit/transloadit/test_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@
end

it "must remember the options passed" do
_(api.options).must_equal(
_(api.options).must_equal({
foo: foo,
bar: bar
)
})
end

it "must inspect like a hash" do
_(api.inspect).must_equal api.to_hash.inspect
end

it "must produce Transloadit-compatible hash output" do
_(api.to_hash).must_equal(
_(api.to_hash).must_equal({
auth: transloadit.to_hash,
foo: foo,
bar: bar
)
})
end

it "must produce Transloadit-compatible JSON output" do
Expand Down
9 changes: 5 additions & 4 deletions test/unit/transloadit/test_assembly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@

it "must not wrap a hash step" do
@assembly.options[:steps] = {foo: 1}
_(@assembly.steps).must_equal foo: 1
_(@assembly.steps).must_equal({foo: 1})
end

it "must produce Transloadit-compatible hash output" do
_(@assembly.to_hash).must_equal(
_(@assembly.to_hash).must_equal({
auth: @transloadit.to_hash,
steps: @assembly.steps,
redirect_url: @redirect
)
})
end

it "must submit files for upload" do
Expand Down Expand Up @@ -170,7 +170,8 @@
response = @assembly.create! open("lib/transloadit/version.rb")
_(response["ok"]).must_equal "ASSEMBLY_COMPLETED"
}
_(warning).must_equal "Rate limit reached. Waiting for 0 seconds before retrying.\n"
# Dependencies may emit deprecation warnings on their first use.
_(warning.lines.count("Rate limit reached. Waiting for 0 seconds before retrying.\n")).must_equal 1
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/unit/transloadit/test_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

_(returned).must_be_same_as response
_(response["ok"]).must_equal "ASSEMBLY_COMPLETED"
_(response.headers).must_equal x_request_id: "new-request"
_(response.headers).must_equal({x_request_id: "new-request"})
_(response.code).must_equal 200
_(response.status).must_equal 200
end
Expand Down
8 changes: 4 additions & 4 deletions test/unit/transloadit/test_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@
end

it "must remember the parameters" do
_(@step.options).must_equal(
_(@step.options).must_equal({
key: @key,
secret: @secret,
bucket: @bucket
)
})
end

it "must inspect like a hash" do
_(@step.inspect).must_equal @step.to_hash[@step.name].inspect
end

it "must produce Transloadit-compatible hash output" do
_(@step.to_hash).must_equal(
_(@step.to_hash).must_equal({
@step.name => {
robot: @robot,
key: @key,
secret: @secret,
bucket: @bucket
}
)
})
end

it "must produce Transloadit-compatible JSON output" do
Expand Down
10 changes: 5 additions & 5 deletions test/unit/transloadit/test_transport_compatibility.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
_(response["ok"]).must_equal "ASSEMBLY_COMPLETED"
assert_requested(:get, /\A#{Regexp.escape(endpoint)}/) do |request|
query = Addressable::URI.parse(request.uri.to_s).query_values
_(MultiJson.load(query.fetch("params"))).must_equal "wait" => true
_(MultiJson.load(query.fetch("params"))).must_equal({"wait" => true})
_(query.fetch("signature")).must_match(/\Asha384:[0-9a-f]{96}\z/)
_(request.headers.fetch("Transloadit-Client")).must_equal "ruby-sdk:#{Transloadit::VERSION}"
end
Expand All @@ -38,7 +38,7 @@

assert_requested(:post, endpoint) do |request|
form = URI.decode_www_form(request.body).to_h
_(MultiJson.load(form.fetch("params"))).must_equal "template_id" => "template-id"
_(MultiJson.load(form.fetch("params"))).must_equal({"template_id" => "template-id"})
_(form.fetch("signature")).must_match(/\Asha384:[0-9a-f]{96}\z/)
_(request.headers.fetch("Content-Type")).must_match(/\Aapplication\/x-www-form-urlencoded/)
end
Expand All @@ -53,7 +53,7 @@

assert_requested(:put, endpoint) do |request|
form = URI.decode_www_form(request.body).to_h
_(MultiJson.load(form.fetch("params"))).must_equal "name" => "Updated"
_(MultiJson.load(form.fetch("params"))).must_equal({"name" => "Updated"})
_(form.fetch("signature")).must_match(/\Asha384:[0-9a-f]{96}\z/)
end
end
Expand All @@ -67,7 +67,7 @@

assert_requested(:delete, endpoint) do |request|
form = URI.decode_www_form(request.body).to_h
_(MultiJson.load(form.fetch("params"))).must_equal "reason" => "cleanup"
_(MultiJson.load(form.fetch("params"))).must_equal({"reason" => "cleanup"})
_(form.fetch("signature")).must_match(/\Asha384:[0-9a-f]{96}\z/)
end
end
Expand All @@ -86,7 +86,7 @@
_(response).wont_be_kind_of Faraday::Response
_(response.code).must_equal 422
_(response.status).must_equal 422
_(response.headers).must_equal retry_after: "5", x_request_id: "request-id"
_(response.headers).must_equal({retry_after: "5", x_request_id: "request-id"})
_(response["error"]).must_equal "ASSEMBLY_NOT_FOUND"
end

Expand Down
Loading