Merge pull request #14021 from mkllnk/money

Remove dead code from Spree::Money
This commit is contained in:
David Cook
2026-03-18 10:50:54 +11:00
committed by GitHub
3 changed files with 2 additions and 8 deletions

View File

@@ -6,8 +6,6 @@ module Spree
class Money
attr_reader :money
delegate :cents, to: :money
def initialize(amount, options = {})
@money = ::Monetize.parse([amount, options[:currency] || CurrentConfig.get(:currency)].join)
@@ -32,10 +30,6 @@ module Spree
.html_safe # rubocop:disable Rails/OutputSafety
end
def format(options = {})
@money.format(@options.merge!(options))
end
def ==(other)
@money == other.money
end

View File

@@ -17,7 +17,7 @@ RSpec.describe Spree::Money do
it "can get cents" do
money = Spree::Money.new(10)
expect(money.cents).to eq(1000)
expect(money.money.cents).to eq(1000)
end
context "with currency" do

View File

@@ -86,7 +86,7 @@ module StripeStubs
def stub_capture_request(order, response_mock)
stub_request(:post, "https://api.stripe.com/v1/payment_intents/pi_123/capture")
.with(body: { amount_to_capture: Spree::Money.new(order.total).cents },
.with(body: { amount_to_capture: Spree::Money.new(order.total).money.cents },
headers: { 'Stripe-Account' => 'abc123' })
.to_return(response_mock)
end