mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 22:34:47 +00:00
* Initial mercury impl * FIX both mercury and generator class * Finish mercury integration and provider generator * Fix schema * Fix linter and tags * Update routes.rb * Avoid schema drift --------- Signed-off-by: soky srm <sokysrm@gmail.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
30 lines
997 B
Ruby
30 lines
997 B
Ruby
require "test_helper"
|
|
|
|
class Provider::MercuryTest < ActiveSupport::TestCase
|
|
def setup
|
|
@provider = Provider::Mercury.new("test_token", base_url: "https://api-sandbox.mercury.com/api/v1")
|
|
end
|
|
|
|
test "initializes with token and default base_url" do
|
|
provider = Provider::Mercury.new("my_token")
|
|
assert_equal "my_token", provider.token
|
|
assert_equal "https://api.mercury.com/api/v1", provider.base_url
|
|
end
|
|
|
|
test "initializes with custom base_url" do
|
|
assert_equal "test_token", @provider.token
|
|
assert_equal "https://api-sandbox.mercury.com/api/v1", @provider.base_url
|
|
end
|
|
|
|
test "MercuryError includes error_type" do
|
|
error = Provider::Mercury::MercuryError.new("Test error", :unauthorized)
|
|
assert_equal "Test error", error.message
|
|
assert_equal :unauthorized, error.error_type
|
|
end
|
|
|
|
test "MercuryError defaults error_type to unknown" do
|
|
error = Provider::Mercury::MercuryError.new("Test error")
|
|
assert_equal :unknown, error.error_type
|
|
end
|
|
end
|