mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-19 04:49:15 +00:00
Merge pull request #14021 from mkllnk/money
Remove dead code from Spree::Money
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user