shopify-money 0.16.0 → 1.0.2.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
  require 'spec_helper'
3
3
 
4
- RSpec.describe AccountingMoneyParser do
5
- describe "parsing of amounts with period decimal separator" do
6
- before(:each) do
7
- @parser = AccountingMoneyParser.new
8
- end
4
+ RSpec.describe Money::Parser::Accounting do
5
+ before(:each) do
6
+ @parser = described_class
7
+ end
9
8
 
9
+ describe "parsing of amounts with period decimal separator" do
10
10
  it "parses parenthesis as a negative amount eg (99.00)" do
11
11
  expect(@parser.parse("(99.00)")).to eq(Money.new(-99.00))
12
12
  end
@@ -20,8 +20,10 @@ RSpec.describe AccountingMoneyParser do
20
20
  end
21
21
 
22
22
  it "parses an invalid string to $0" do
23
- expect(Money).to receive(:deprecate).once
24
- expect(@parser.parse("no money")).to eq(Money.new)
23
+ configure(legacy_deprecations: true) do
24
+ expect(Money).to receive(:deprecate).once
25
+ expect(@parser.parse("no money", 'USD')).to eq(Money.new(0, 'USD'))
26
+ end
25
27
  end
26
28
 
27
29
  it "parses a single digit integer string" do
@@ -102,10 +104,6 @@ RSpec.describe AccountingMoneyParser do
102
104
  end
103
105
 
104
106
  describe "parsing of amounts with comma decimal separator" do
105
- before(:each) do
106
- @parser = AccountingMoneyParser.new
107
- end
108
-
109
107
  it "parses dollar amount $1,00 with leading $" do
110
108
  expect(@parser.parse("$1,00")).to eq(Money.new(1.00))
111
109
  end
@@ -154,10 +152,6 @@ RSpec.describe AccountingMoneyParser do
154
152
  end
155
153
 
156
154
  describe "parsing of decimal cents amounts from 0 to 10" do
157
- before(:each) do
158
- @parser = AccountingMoneyParser.new
159
- end
160
-
161
155
  it "parses 50.0" do
162
156
  expect(@parser.parse("50.0")).to eq(Money.new(50.00))
163
157
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
  require 'spec_helper'
3
3
 
4
- RSpec.describe MoneyParser do
4
+ RSpec.describe Money::Parser::Fuzzy do
5
5
  before(:each) do
6
- @parser = MoneyParser
6
+ @parser = described_class
7
7
  end
8
8
 
9
9
  describe "parsing of amounts with period decimal separator" do
@@ -12,14 +12,22 @@ RSpec.describe MoneyParser do
12
12
  end
13
13
 
14
14
  it "parses an invalid string when not strict" do
15
- expect(Money).to receive(:deprecate).twice
16
- expect(@parser.parse("no money")).to eq(Money.new(0, Money::NULL_CURRENCY))
17
- expect(@parser.parse("1..")).to eq(Money.new(1))
15
+ configure(legacy_deprecations: true) do
16
+ expect(Money).to receive(:deprecate).twice
17
+ expect(@parser.parse("no money", 'USD')).to eq(Money.new(0, 'USD'))
18
+ expect(@parser.parse("1..", 'USD')).to eq(Money.new(1, 'USD'))
19
+ end
18
20
  end
19
21
 
20
22
  it "parses raise with an invalid string and strict option" do
21
- expect { @parser.parse("no money", strict: true) }.to raise_error(MoneyParser::MoneyFormatError)
22
- expect { @parser.parse("1..1", strict: true) }.to raise_error(MoneyParser::MoneyFormatError)
23
+ expect { @parser.parse("no money", strict: true) }.to raise_error(described_class::MoneyFormatError)
24
+ expect { @parser.parse("1..1", strict: true) }.to raise_error(described_class::MoneyFormatError)
25
+ end
26
+
27
+ it "parses raise with an invalid when a currency is missing" do
28
+ configure do
29
+ expect { @parser.parse("1") }.to raise_error(Money::Currency::UnknownCurrency)
30
+ end
23
31
  end
24
32
 
25
33
  it "parses a single digit integer string" do
@@ -144,12 +152,14 @@ RSpec.describe MoneyParser do
144
152
  end
145
153
 
146
154
  it "parses amount with multiple inconsistent thousands delimiters" do
147
- expect(Money).to receive(:deprecate).once
148
- expect(@parser.parse("1.1.11.111")).to eq(Money.new(1_111_111))
155
+ configure(legacy_deprecations: true) do
156
+ expect(Money).to receive(:deprecate).once
157
+ expect(@parser.parse("1.1.11.111", 'USD')).to eq(Money.new(1_111_111, 'USD'))
158
+ end
149
159
  end
150
160
 
151
161
  it "parses raises with multiple inconsistent thousands delimiters and strict option" do
152
- expect { @parser.parse("1.1.11.111", strict: true) }.to raise_error(MoneyParser::MoneyFormatError)
162
+ expect { @parser.parse("1.1.11.111", strict: true) }.to raise_error(described_class::MoneyFormatError)
153
163
  end
154
164
  end
155
165
 
@@ -216,12 +226,14 @@ RSpec.describe MoneyParser do
216
226
  end
217
227
 
218
228
  it "parses amount with multiple inconsistent thousands delimiters" do
219
- expect(Money).to receive(:deprecate).once
220
- expect(@parser.parse("1,1,11,111")).to eq(Money.new(1_111_111))
229
+ configure(legacy_deprecations: true) do
230
+ expect(Money).to receive(:deprecate).once
231
+ expect(@parser.parse("1,1,11,111", 'USD')).to eq(Money.new(1_111_111, 'USD'))
232
+ end
221
233
  end
222
234
 
223
235
  it "parses raises with multiple inconsistent thousands delimiters and strict option" do
224
- expect { @parser.parse("1,1,11,111", strict: true) }.to raise_error(MoneyParser::MoneyFormatError)
236
+ expect { @parser.parse("1,1,11,111", strict: true) }.to raise_error(described_class::MoneyFormatError)
225
237
  end
226
238
  end
227
239
 
@@ -0,0 +1,208 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe Money::Parser::LocaleAware do
5
+ context "parsing amounts with period decimal separator" do
6
+ around(:example) do |example|
7
+ with_decimal_separator(".") { example.run }
8
+ end
9
+
10
+ it "parses an empty string to nil" do
11
+ expect(described_class.parse("", "CAD")).to be_nil
12
+ end
13
+
14
+ it "parses an invalid string when not strict" do
15
+ expect(described_class.parse("no money", "CAD")).to be_nil
16
+ expect(described_class.parse("1..", "CAD")).to be_nil
17
+ end
18
+
19
+ it "raises with an invalid string and strict option" do
20
+ expect { described_class.parse("no money", "CAD", strict: true) }.to raise_error(ArgumentError)
21
+ expect { described_class.parse("1..1", "CAD", strict: true) }.to raise_error(ArgumentError)
22
+ end
23
+
24
+ it "parses an integer string amount" do
25
+ expect(described_class.parse("1", "CAD")).to eq(Money.new(1.00, "CAD"))
26
+ expect(described_class.parse("-1", "CAD")).to eq(Money.new(-1.00, "CAD"))
27
+ end
28
+
29
+ it "parses a float string amount" do
30
+ expect(described_class.parse("1.37", "CAD")).to eq(Money.new(1.37, "CAD"))
31
+ expect(described_class.parse("-1.37", "CAD")).to eq(Money.new(-1.37, "CAD"))
32
+ end
33
+
34
+ it "parses a float string with 3 decimals" do
35
+ expect(described_class.parse("1.378", "JOD")).to eq(Money.new(1.378, "JOD"))
36
+ expect(described_class.parse("-1.378", "JOD")).to eq(Money.new(-1.378, "JOD"))
37
+ expect(described_class.parse("123.456", "USD")).to eq(Money.new(123.46, "USD"))
38
+ end
39
+
40
+ it "parses a float string amount with a leading random character" do
41
+ expect(described_class.parse("$1.37", "CAD")).to eq(Money.new(1.37, "CAD"))
42
+ expect(described_class.parse(",1.37", "CAD")).to eq(Money.new(1.37, "CAD"))
43
+ expect(described_class.parse("€1.37", "CAD")).to eq(Money.new(1.37, "CAD"))
44
+ end
45
+
46
+ it "parses a float string amount with a trailing random character" do
47
+ expect(described_class.parse("1.37$", "CAD")).to eq(Money.new(1.37, "CAD"))
48
+ expect(described_class.parse("1.37,", "CAD")).to eq(Money.new(1.37, "CAD"))
49
+ expect(described_class.parse("1.37€", "CAD")).to eq(Money.new(1.37, "CAD"))
50
+ end
51
+
52
+ it "parses an amount with one or more thousands separators" do
53
+ expect(described_class.parse("100,000", "CAD")).to eq(Money.new(100_000.00, "CAD"))
54
+ expect(described_class.parse("-100,000", "CAD")).to eq(Money.new(-100_000.00, "CAD"))
55
+ expect(described_class.parse("100,000.01", "CAD")).to eq(Money.new(100_000.01, "CAD"))
56
+ expect(described_class.parse("1,00,000.01", "CAD")).to eq(Money.new(100_000.01, "CAD"))
57
+ expect(described_class.parse("1,00,000.001", "JOD")).to eq(Money.new(100_000.001, "JOD"))
58
+ end
59
+ end
60
+
61
+ context "parsing amounts with comma decimal separator" do
62
+ around(:example) do |example|
63
+ with_decimal_separator(",") { example.run }
64
+ end
65
+
66
+ it "parses an empty string to nil" do
67
+ expect(described_class.parse("", "CAD")).to be_nil
68
+ end
69
+
70
+ it "parses an invalid string when not strict" do
71
+ expect(described_class.parse("no money", "CAD")).to be_nil
72
+ expect(described_class.parse("1,,", "CAD")).to be_nil
73
+ end
74
+
75
+ it "raises with an invalid string and strict option" do
76
+ expect { described_class.parse("no money", "CAD", strict: true) }.to raise_error(ArgumentError)
77
+ expect { described_class.parse("1,,1", "CAD", strict: true) }.to raise_error(ArgumentError)
78
+ end
79
+
80
+ it "parses an integer string amount" do
81
+ expect(described_class.parse("1", "CAD")).to eq(Money.new(1.00, "CAD"))
82
+ expect(described_class.parse("-1", "CAD")).to eq(Money.new(-1.00, "CAD"))
83
+ end
84
+
85
+ it "parses a float string amount" do
86
+ expect(described_class.parse("1,37", "CAD")).to eq(Money.new(1.37, "CAD"))
87
+ expect(described_class.parse("-1,37", "CAD")).to eq(Money.new(-1.37, "CAD"))
88
+ end
89
+
90
+ it "parses a float string with 3 decimals" do
91
+ expect(described_class.parse("1,378", "JOD")).to eq(Money.new(1.378, "JOD"))
92
+ expect(described_class.parse("-1,378", "JOD")).to eq(Money.new(-1.378, "JOD"))
93
+ end
94
+
95
+ it "parses a float string amount with a leading random character" do
96
+ expect(described_class.parse("$1,37", "CAD")).to eq(Money.new(1.37, "CAD"))
97
+ expect(described_class.parse(".1,37", "CAD")).to eq(Money.new(1.37, "CAD"))
98
+ expect(described_class.parse("€1,37", "CAD")).to eq(Money.new(1.37, "CAD"))
99
+ end
100
+
101
+ it "parses a float string amount with a trailing random character" do
102
+ expect(described_class.parse("1,37$", "CAD")).to eq(Money.new(1.37, "CAD"))
103
+ expect(described_class.parse("1,37.", "CAD")).to eq(Money.new(1.37, "CAD"))
104
+ expect(described_class.parse("1,37€", "CAD")).to eq(Money.new(1.37, "CAD"))
105
+ end
106
+
107
+ it "parses an amount with one or more thousands separators" do
108
+ expect(described_class.parse("100.000", "CAD")).to eq(Money.new(100_000.00, "CAD"))
109
+ expect(described_class.parse("-100.000", "CAD")).to eq(Money.new(-100_000.00, "CAD"))
110
+ expect(described_class.parse("100.000,01", "CAD")).to eq(Money.new(100_000.01, "CAD"))
111
+ expect(described_class.parse("1.00.000,01", "CAD")).to eq(Money.new(100_000.01, "CAD"))
112
+ expect(described_class.parse("1.00.000,001", "JOD")).to eq(Money.new(100_000.001, "JOD"))
113
+ end
114
+ end
115
+
116
+ context "parsing amounts with fullwidth characters" do
117
+ around(:example) do |example|
118
+ with_decimal_separator(".") { example.run }
119
+ end
120
+
121
+ it "parses an empty string to nil" do
122
+ expect(described_class.parse("", "CAD")).to be_nil
123
+ end
124
+
125
+ it "parses an invalid string when not strict" do
126
+ expect(described_class.parse("no money", "CAD")).to be_nil
127
+ expect(described_class.parse("1..", "CAD")).to be_nil
128
+ end
129
+
130
+ it "raises with an invalid string and strict option" do
131
+ expect { described_class.parse("no money", "CAD", strict: true) }.to raise_error(ArgumentError)
132
+ expect { described_class.parse("1..1", "CAD", strict: true) }.to raise_error(ArgumentError)
133
+ end
134
+
135
+ it "parses an integer string amount" do
136
+ expect(described_class.parse("1", "CAD")).to eq(Money.new(1.00, "CAD"))
137
+ expect(described_class.parse("-1", "CAD")).to eq(Money.new(-1.00, "CAD"))
138
+ end
139
+
140
+ it "parses a float string amount" do
141
+ expect(described_class.parse("1.37", "CAD")).to eq(Money.new(1.37, "CAD"))
142
+ expect(described_class.parse("-1.37", "CAD")).to eq(Money.new(-1.37, "CAD"))
143
+ end
144
+
145
+ it "parses a float string with 3 decimals" do
146
+ expect(described_class.parse("1.378", "JOD")).to eq(Money.new(1.378, "JOD"))
147
+ expect(described_class.parse("-1.378", "JOD")).to eq(Money.new(-1.378, "JOD"))
148
+ end
149
+
150
+ it "parses a float string amount with a leading random character" do
151
+ expect(described_class.parse("$1.37", "CAD")).to eq(Money.new(1.37, "CAD"))
152
+ expect(described_class.parse(",1.37", "CAD")).to eq(Money.new(1.37, "CAD"))
153
+ expect(described_class.parse("€1.37", "CAD")).to eq(Money.new(1.37, "CAD"))
154
+ end
155
+
156
+ it "parses a float string amount with a trailing random character" do
157
+ expect(described_class.parse("1.37$", "CAD")).to eq(Money.new(1.37, "CAD"))
158
+ expect(described_class.parse("1.37,", "CAD")).to eq(Money.new(1.37, "CAD"))
159
+ expect(described_class.parse("1.37€", "CAD")).to eq(Money.new(1.37, "CAD"))
160
+ end
161
+
162
+ it "parses an amount with one or more thousands separators" do
163
+ expect(described_class.parse("100,000", "CAD")).to eq(Money.new(100_000.00, "CAD"))
164
+ expect(described_class.parse("-100,000", "CAD")).to eq(Money.new(-100_000.00, "CAD"))
165
+ expect(described_class.parse("100,000.01", "CAD")).to eq(Money.new(100_000.01, "CAD"))
166
+ expect(described_class.parse("1,00,000.01", "CAD")).to eq(Money.new(100_000.01, "CAD"))
167
+ expect(described_class.parse("1,00,000.001", "JOD")).to eq(Money.new(100_000.001, "JOD"))
168
+ expect(described_class.parse("100,000、000", "JPY")).to eq(Money.new(100_000_000, "JPY"))
169
+ end
170
+ end
171
+
172
+ context "bad decimal_separator_proc" do
173
+ context "raises when called" do
174
+ around(:example) do |example|
175
+ with_decimal_separator_proc(->() { raise NoMethodError }) { example.run }
176
+ end
177
+
178
+ it "raises the original error" do
179
+ expect { described_class.parse("1", "CAD") }.to raise_error(NoMethodError)
180
+ end
181
+ end
182
+
183
+ context "returning nil" do
184
+ around(:example) do |example|
185
+ with_decimal_separator(nil) { example.run }
186
+ end
187
+
188
+ it "raises the original error" do
189
+ expect { described_class.parse("1", "CAD") }.to raise_error(ArgumentError)
190
+ end
191
+ end
192
+ end
193
+
194
+ private
195
+
196
+ def with_decimal_separator(character)
197
+ with_decimal_separator_proc(->() { character }) do
198
+ yield
199
+ end
200
+ end
201
+
202
+ def with_decimal_separator_proc(proc)
203
+ old = described_class.decimal_separator_resolver
204
+ described_class.decimal_separator_resolver = proc
205
+ yield
206
+ described_class.decimal_separator_resolver = old
207
+ end
208
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe Money::Parser::Simple do
5
+ context "parsing amounts with period decimal separator" do
6
+ it "parses an empty string to nil" do
7
+ expect(described_class.parse("", "CAD")).to be_nil
8
+ end
9
+
10
+ it "parses an invalid string when not strict" do
11
+ expect(described_class.parse("no money", "CAD")).to be_nil
12
+ expect(described_class.parse("1..", "CAD")).to be_nil
13
+ expect(described_class.parse("10.", "CAD")).to be_nil
14
+ expect(described_class.parse("10.1E2", "CAD")).to be_nil
15
+ end
16
+
17
+ it "raises with an invalid string and strict option" do
18
+ expect { described_class.parse("no money", "CAD", strict: true) }.to raise_error(ArgumentError)
19
+ expect { described_class.parse("1..1", "CAD", strict: true) }.to raise_error(ArgumentError)
20
+ expect { described_class.parse("10.", "CAD", strict: true) }.to raise_error(ArgumentError)
21
+ expect { described_class.parse("10.1E2", "CAD", strict: true) }.to raise_error(ArgumentError)
22
+ end
23
+
24
+ it "parses an integer string amount" do
25
+ expect(described_class.parse("1", "CAD")).to eq(Money.new(1.00, "CAD"))
26
+ expect(described_class.parse("-1", "CAD")).to eq(Money.new(-1.00, "CAD"))
27
+ end
28
+
29
+ it "parses a float string amount" do
30
+ expect(described_class.parse("1.37", "CAD")).to eq(Money.new(1.37, "CAD"))
31
+ expect(described_class.parse("-1.37", "CAD")).to eq(Money.new(-1.37, "CAD"))
32
+ end
33
+
34
+ it "parses a float string with 3 decimals" do
35
+ expect(described_class.parse("1.378", "JOD")).to eq(Money.new(1.378, "JOD"))
36
+ expect(described_class.parse("-1.378", "JOD")).to eq(Money.new(-1.378, "JOD"))
37
+ expect(described_class.parse("123.456", "USD")).to eq(Money.new(123.46, "USD"))
38
+ end
39
+
40
+ it "does not parse a float string amount with a leading random character" do
41
+ expect(described_class.parse("$1.37", "CAD")).to be_nil
42
+ expect(described_class.parse(",1.37", "CAD")).to be_nil
43
+ expect(described_class.parse("€1.37", "CAD")).to be_nil
44
+ expect(described_class.parse(" 1.37", "CAD")).to be_nil
45
+ end
46
+
47
+ it "does not parse a float string amount with a trailing random character" do
48
+ expect(described_class.parse("1.37$", "CAD")).to be_nil
49
+ expect(described_class.parse("1.37,", "CAD")).to be_nil
50
+ expect(described_class.parse("1.37€", "CAD")).to be_nil
51
+ expect(described_class.parse("1.37 ", "CAD")).to be_nil
52
+ end
53
+
54
+ it "does not parse an amount with one or more thousands separators" do
55
+ expect(described_class.parse("100,000", "CAD")).to be_nil
56
+ expect(described_class.parse("-100,000", "CAD")).to be_nil
57
+ expect(described_class.parse("100,000.01", "CAD")).to be_nil
58
+ expect(described_class.parse("1,00,000.01", "CAD")).to be_nil
59
+ expect(described_class.parse("1,00,000.001", "JOD")).to be_nil
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails_spec_helper"
4
+
5
+ RSpec.describe Money::Rails::JobArgumentSerializer do
6
+ it "roundtrip a Money argument returns the same object" do
7
+ job = MoneyTestJob.new(value: Money.new(10.21, "BRL"))
8
+
9
+ serialized_job = job.serialize
10
+ serialized_value = serialized_job["arguments"][0]["value"]
11
+ expect(serialized_value["_aj_serialized"]).to eq("Money::Rails::JobArgumentSerializer")
12
+ expect(serialized_value["value"]).to eq(BigDecimal("10.21"))
13
+ expect(serialized_value["currency"]).to eq("BRL")
14
+
15
+ job2 = MoneyTestJob.deserialize(serialized_job)
16
+ job2.send(:deserialize_arguments_if_needed)
17
+
18
+ expect(job2.arguments.first[:value]).to eq(Money.new(10.21, "BRL"))
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_job"
4
+ require_relative "spec_helper"
5
+
6
+ Money::Railtie.initializers.each(&:run)
7
+
8
+ class MoneyTestJob < ActiveJob::Base
9
+ def perform(_params)
10
+ end
11
+ end
data/spec/spec_helper.rb CHANGED
@@ -3,6 +3,7 @@ require 'simplecov'
3
3
  SimpleCov.minimum_coverage 100
4
4
  SimpleCov.start do
5
5
  add_filter "/spec/"
6
+ add_filter "/lib/money/railtie"
6
7
  end
7
8
 
8
9
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
@@ -68,3 +69,17 @@ RSpec::Matchers.define :quack_like do
68
69
  expected.instance_methods - actual.instance_methods
69
70
  end
70
71
  end
72
+
73
+
74
+ def configure(default_currency: nil, legacy_json_format: nil, legacy_deprecations: nil, legacy_default_currency: nil)
75
+ old_config = Money.config
76
+ Money.config = Money::Config.new.tap do |config|
77
+ config.default_currency = default_currency if default_currency
78
+ config.legacy_json_format! if legacy_json_format
79
+ config.legacy_deprecations! if legacy_deprecations
80
+ config.legacy_default_currency! if legacy_default_currency
81
+ end
82
+ yield
83
+ ensure
84
+ Money.config = old_config
85
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify-money
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 1.0.2.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-03 00:00:00.000000000 Z
11
+ date: 2022-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -110,14 +110,15 @@ files:
110
110
  - LICENSE.txt
111
111
  - README.md
112
112
  - Rakefile
113
+ - UPGRADING.md
113
114
  - bin/console
114
115
  - config/currency_historic.yml
115
116
  - config/currency_iso.yml
116
117
  - config/currency_non_iso.yml
117
118
  - dev.yml
118
119
  - lib/money.rb
119
- - lib/money/accounting_money_parser.rb
120
120
  - lib/money/allocator.rb
121
+ - lib/money/config.rb
121
122
  - lib/money/core_extensions.rb
122
123
  - lib/money/currency.rb
123
124
  - lib/money/currency/loader.rb
@@ -125,8 +126,13 @@ files:
125
126
  - lib/money/errors.rb
126
127
  - lib/money/helpers.rb
127
128
  - lib/money/money.rb
128
- - lib/money/money_parser.rb
129
129
  - lib/money/null_currency.rb
130
+ - lib/money/parser/accounting.rb
131
+ - lib/money/parser/fuzzy.rb
132
+ - lib/money/parser/locale_aware.rb
133
+ - lib/money/parser/simple.rb
134
+ - lib/money/rails/job_argument_serializer.rb
135
+ - lib/money/railtie.rb
130
136
  - lib/money/version.rb
131
137
  - lib/money_column.rb
132
138
  - lib/money_column/active_record_hooks.rb
@@ -137,16 +143,21 @@ files:
137
143
  - lib/rubocop/cop/money/zero_money.rb
138
144
  - lib/shopify-money.rb
139
145
  - money.gemspec
140
- - spec/accounting_money_parser_spec.rb
141
146
  - spec/allocator_spec.rb
147
+ - spec/config_spec.rb
142
148
  - spec/core_extensions_spec.rb
143
149
  - spec/currency/loader_spec.rb
144
150
  - spec/currency_spec.rb
145
151
  - spec/helpers_spec.rb
146
152
  - spec/money_column_spec.rb
147
- - spec/money_parser_spec.rb
148
153
  - spec/money_spec.rb
149
154
  - spec/null_currency_spec.rb
155
+ - spec/parser/accounting_spec.rb
156
+ - spec/parser/fuzzy_spec.rb
157
+ - spec/parser/locale_aware_spec.rb
158
+ - spec/parser/simple_spec.rb
159
+ - spec/rails/job_argument_serializer_spec.rb
160
+ - spec/rails_spec_helper.rb
150
161
  - spec/rubocop/cop/money/missing_currency_spec.rb
151
162
  - spec/rubocop/cop/money/zero_money_spec.rb
152
163
  - spec/rubocop_helper.rb
@@ -168,25 +179,30 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
179
  version: '2.6'
169
180
  required_rubygems_version: !ruby/object:Gem::Requirement
170
181
  requirements:
171
- - - ">="
182
+ - - ">"
172
183
  - !ruby/object:Gem::Version
173
- version: '0'
184
+ version: 1.3.1
174
185
  requirements: []
175
- rubygems_version: 3.0.3
186
+ rubygems_version: 3.2.20
176
187
  signing_key:
177
188
  specification_version: 4
178
189
  summary: Shopify's money gem
179
190
  test_files:
180
- - spec/accounting_money_parser_spec.rb
181
191
  - spec/allocator_spec.rb
192
+ - spec/config_spec.rb
182
193
  - spec/core_extensions_spec.rb
183
194
  - spec/currency/loader_spec.rb
184
195
  - spec/currency_spec.rb
185
196
  - spec/helpers_spec.rb
186
197
  - spec/money_column_spec.rb
187
- - spec/money_parser_spec.rb
188
198
  - spec/money_spec.rb
189
199
  - spec/null_currency_spec.rb
200
+ - spec/parser/accounting_spec.rb
201
+ - spec/parser/fuzzy_spec.rb
202
+ - spec/parser/locale_aware_spec.rb
203
+ - spec/parser/simple_spec.rb
204
+ - spec/rails/job_argument_serializer_spec.rb
205
+ - spec/rails_spec_helper.rb
190
206
  - spec/rubocop/cop/money/missing_currency_spec.rb
191
207
  - spec/rubocop/cop/money/zero_money_spec.rb
192
208
  - spec/rubocop_helper.rb
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AccountingMoneyParser < MoneyParser
4
- def parse(input, currency = nil, **options)
5
- # set () to mean negativity. ignore $
6
- super(input.gsub(/\(\$?(.*?)\)/, '-\1'), currency, **options)
7
- end
8
- end