diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 23922dc..db1dbfc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,7 @@ jobs: matrix: ruby: - "3.4" - - "4.0" + - "4.0.6" steps: - uses: actions/checkout@v4 @@ -35,7 +35,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 4.0 + ruby-version: 4.0.6 bundler-cache: true - name: Set up Chrome uses: browser-actions/setup-chrome@v1 diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..d13e837 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +4.0.6 diff --git a/lib/yookassa/entity/product.rb b/lib/yookassa/entity/product.rb index 6c55923..b319cc5 100644 --- a/lib/yookassa/entity/product.rb +++ b/lib/yookassa/entity/product.rb @@ -62,7 +62,7 @@ module Yookassa # Amount of excise tax on products including kopeks. Decimal number with 2 digits after the period. # Online sales register that support this parameter: Orange Data, Kit Invest. - attribute? :excise + attribute? :excise, Types::Coercible::Float # Information about the supplier of product or service. You can specify this parameter if you send the data # for creating the receipt using the Receipt after payment scenario. diff --git a/spec/yookassa/entity/product_spec.rb b/spec/yookassa/entity/product_spec.rb new file mode 100644 index 0000000..4648174 --- /dev/null +++ b/spec/yookassa/entity/product_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +RSpec.describe Yookassa::Entity::Product do + let(:attributes) do + { + description: "Fuel", + quantity: 1, + amount: { value: 100, currency: "RUB" }, + vat_code: 1 + } + end + + it "defines excise as an optional numeric attribute" do + expect(described_class.new(**attributes, excise: "12.34").excise).to eq(12.34) + expect(described_class.new(**attributes).excise).to be_nil + end +end