mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-04 00:00:47 -04:00
* Bump Rubocop to 0.57.2 * Style/StderrPuts: Use warn instead of .puts * Style/ExpandPathArguments: Use expand_path('../test_helper', __dir__) instead of expand_path('../../test_helper', __FILE__) * Style/Encoding: Unnecessary utf-8 encoding comment * Style/StringLiterals: Prefer double-quoted strings * Style/AccessModifierDeclarations * Style/FormatStringToken: Prefer annotated tokens * Naming/UncommunicativeMethodParamName * Metrics/LineLength: set maximum line length to 100 characters * Style/IfUnlessModifier: Favor modifier if usage when having a single-line body * Style/ClassVars * Metrics/LineLength: set maximum line length to 80 characters (default) * Style/AccessModifierDeclarations: EnforcedStyle: inline
44 lines
1.3 KiB
Ruby
44 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require ::File.expand_path("../test_helper", __dir__)
|
|
|
|
module Stripe
|
|
class TaxRateTest < Test::Unit::TestCase
|
|
should "be listable" do
|
|
tax_rates = Stripe::TaxRate.list
|
|
assert_requested :get, "#{Stripe.api_base}/v1/tax_rates"
|
|
assert tax_rates.data.is_a?(Array)
|
|
assert tax_rates.first.is_a?(Stripe::TaxRate)
|
|
end
|
|
|
|
should "be retrievable" do
|
|
tax_rate = Stripe::TaxRate.retrieve("txr_123")
|
|
assert_requested :get, "#{Stripe.api_base}/v1/tax_rates/txr_123"
|
|
assert tax_rate.is_a?(Stripe::TaxRate)
|
|
end
|
|
|
|
should "be creatable" do
|
|
tax_rate = Stripe::TaxRate.create(
|
|
display_name: "name",
|
|
inclusive: false,
|
|
percentage: 10.15
|
|
)
|
|
assert_requested :post, "#{Stripe.api_base}/v1/tax_rates"
|
|
assert tax_rate.is_a?(Stripe::TaxRate)
|
|
end
|
|
|
|
should "be saveable" do
|
|
tax_rate = Stripe::TaxRate.retrieve("txr_123")
|
|
tax_rate.metadata["key"] = "value"
|
|
tax_rate.save
|
|
assert_requested :post, "#{Stripe.api_base}/v1/tax_rates/#{tax_rate.id}"
|
|
end
|
|
|
|
should "be updateable" do
|
|
tax_rate = Stripe::TaxRate.update("txr_123", metadata: { key: "value" })
|
|
assert_requested :post, "#{Stripe.api_base}/v1/tax_rates/txr_123"
|
|
assert tax_rate.is_a?(Stripe::TaxRate)
|
|
end
|
|
end
|
|
end
|