money_column 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/Gemfile.lock +53 -23
- data/lib/money_column/version.rb +1 -1
- data/money_column.gemspec +8 -8
- data/spec/money_column/money_column_spec.rb +29 -28
- data/spec/spec_helper.rb +4 -5
- metadata +28 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 615f522acf1a78cd4a50ff33030f07b1bcac19a8
|
4
|
+
data.tar.gz: b9954ab9e98388eab30fd459b8c8064ade552ee3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 408ebda7bb614350d626b686e24df19941c3b09225e855c55f5550db7472f3e59ca56fcb7e6c7973b031fc909766ec5b8f9df637d4ccfa67b8b4cbe928709215
|
7
|
+
data.tar.gz: b31f044ca2764b35d31fc6cf4d20993436a1fa12a629e600ed223647dd6c86020c7962f9690e23a9e4a168895ce9ea321c5579d4c5bf5e0314956a3a59cd91c7
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,47 +2,77 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
money_column (0.2.3)
|
5
|
-
activesupport (
|
5
|
+
activesupport (~> 3.2.19)
|
6
6
|
monetize (= 0.3.0)
|
7
7
|
money (= 6.1.1)
|
8
8
|
|
9
9
|
GEM
|
10
|
-
remote:
|
10
|
+
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (3.2.
|
12
|
+
activesupport (3.2.19)
|
13
13
|
i18n (~> 0.6, >= 0.6.4)
|
14
14
|
multi_json (~> 1.0)
|
15
|
-
|
15
|
+
celluloid (0.15.2)
|
16
|
+
timers (~> 1.1.0)
|
17
|
+
coderay (1.1.0)
|
18
|
+
diff-lcs (1.2.5)
|
19
|
+
ffi (1.9.3)
|
20
|
+
formatador (0.2.5)
|
16
21
|
growl (1.0.3)
|
17
|
-
guard (
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
+
guard (2.6.1)
|
23
|
+
formatador (>= 0.2.4)
|
24
|
+
listen (~> 2.7)
|
25
|
+
lumberjack (~> 1.0)
|
26
|
+
pry (>= 0.9.12)
|
27
|
+
thor (>= 0.18.1)
|
28
|
+
guard-rspec (4.2.10)
|
29
|
+
guard (~> 2.1)
|
30
|
+
rspec (>= 2.14, < 4.0)
|
31
|
+
i18n (0.6.11)
|
32
|
+
listen (2.7.9)
|
33
|
+
celluloid (>= 0.15.2)
|
34
|
+
rb-fsevent (>= 0.9.3)
|
35
|
+
rb-inotify (>= 0.9)
|
36
|
+
lumberjack (1.0.9)
|
37
|
+
method_source (0.8.2)
|
22
38
|
monetize (0.3.0)
|
23
39
|
money (~> 6.1.0.beta1)
|
24
40
|
money (6.1.1)
|
25
41
|
i18n (~> 0.6.4)
|
26
42
|
multi_json (1.10.1)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
rspec
|
36
|
-
|
43
|
+
pry (0.10.0)
|
44
|
+
coderay (~> 1.1.0)
|
45
|
+
method_source (~> 0.8.1)
|
46
|
+
slop (~> 3.4)
|
47
|
+
rake (10.3.2)
|
48
|
+
rb-fsevent (0.9.4)
|
49
|
+
rb-inotify (0.9.5)
|
50
|
+
ffi (>= 0.5.0)
|
51
|
+
rspec (3.0.0)
|
52
|
+
rspec-core (~> 3.0.0)
|
53
|
+
rspec-expectations (~> 3.0.0)
|
54
|
+
rspec-mocks (~> 3.0.0)
|
55
|
+
rspec-core (3.0.2)
|
56
|
+
rspec-support (~> 3.0.0)
|
57
|
+
rspec-expectations (3.0.2)
|
58
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
59
|
+
rspec-support (~> 3.0.0)
|
60
|
+
rspec-mocks (3.0.2)
|
61
|
+
rspec-support (~> 3.0.0)
|
62
|
+
rspec-support (3.0.2)
|
63
|
+
slop (3.5.0)
|
64
|
+
thor (0.19.1)
|
65
|
+
timers (1.1.0)
|
37
66
|
|
38
67
|
PLATFORMS
|
39
68
|
ruby
|
40
69
|
|
41
70
|
DEPENDENCIES
|
42
|
-
activesupport (
|
71
|
+
activesupport (~> 3.2.19)
|
43
72
|
growl (~> 1.0.3)
|
44
|
-
guard-rspec (~>
|
73
|
+
guard-rspec (~> 4.2.10)
|
45
74
|
monetize (= 0.3.0)
|
46
75
|
money_column!
|
47
|
-
rake (~>
|
48
|
-
|
76
|
+
rake (~> 10.3.2)
|
77
|
+
rb-fsevent (~> 0.9.4)
|
78
|
+
rspec (~> 3.0.0)
|
data/lib/money_column/version.rb
CHANGED
data/money_column.gemspec
CHANGED
@@ -4,29 +4,29 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.specification_version = 3 if s.respond_to? :specification_version=
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.rubygems_version = '1.3.7'
|
7
|
-
|
7
|
+
|
8
8
|
s.name = 'money_column'
|
9
9
|
s.version = MoneyColumn::VERSION
|
10
10
|
s.date = '2012-05-01'
|
11
11
|
s.summary = 'A set of helper methods for working with money-based attributes.'
|
12
12
|
s.description = 'A set of helper methods for working with money-based attributes.'
|
13
|
-
s.authors = ["Michael Klett", "Shay Frendt", "Nathan Verni"]
|
13
|
+
s.authors = ["Michael Klett", "Shay Frendt", "Nathan Verni", "Jeremy W. Rowe"]
|
14
14
|
s.email = 'support@chargify.com'
|
15
15
|
s.homepage = 'http://github.com/chargify/money_column'
|
16
|
-
|
16
|
+
|
17
17
|
s.files = `git ls-files`.split("\n")
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
s.require_paths = %w[lib]
|
20
20
|
|
21
21
|
# Runtime Dependencies
|
22
|
-
s.add_runtime_dependency('activesupport', '3.2.
|
22
|
+
s.add_runtime_dependency('activesupport', '~> 3.2.19')
|
23
23
|
s.add_runtime_dependency('money', '6.1.1')
|
24
24
|
s.add_runtime_dependency('monetize', '0.3.0')
|
25
25
|
|
26
26
|
# Development Dependencies
|
27
|
-
s.add_development_dependency('rake', '~>
|
28
|
-
s.add_development_dependency('rspec', '~>
|
29
|
-
s.add_development_dependency('guard-rspec', '~>
|
27
|
+
s.add_development_dependency('rake', '~> 10.3.2')
|
28
|
+
s.add_development_dependency('rspec', '~> 3.0.0')
|
29
|
+
s.add_development_dependency('guard-rspec', '~> 4.2.10')
|
30
30
|
s.add_development_dependency('growl', '~> 1.0.3')
|
31
|
-
s.add_development_dependency('rb-fsevent', '~> 0.4
|
31
|
+
s.add_development_dependency('rb-fsevent', '~> 0.9.4')
|
32
32
|
end
|
@@ -40,76 +40,77 @@ end
|
|
40
40
|
|
41
41
|
describe "MoneyColumn" do
|
42
42
|
describe "getter method" do
|
43
|
-
it "
|
43
|
+
it "returns a money object based on the inferred cents_attribute" do
|
44
44
|
car = Car.new
|
45
45
|
car.price_in_cents = 1000
|
46
|
-
car.price.
|
46
|
+
expect(car.price).to eql(10.to_money)
|
47
47
|
end
|
48
48
|
|
49
|
-
it "
|
49
|
+
it "returns a money object based on the stated cents_attribute" do
|
50
50
|
car = CarWithSpecifiedAttribute.new
|
51
51
|
car.amount_in_cents = 5000
|
52
|
-
car.price.
|
52
|
+
expect(car.price).to eql(50.to_money)
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
describe "setter method" do
|
57
|
-
it "
|
57
|
+
it "passes on money values" do
|
58
58
|
car = Car.new
|
59
59
|
car.price = 1.to_money
|
60
|
-
car.price.
|
60
|
+
expect(car.price).to eql(1.to_money)
|
61
61
|
end
|
62
|
-
|
63
|
-
it "
|
62
|
+
|
63
|
+
it "converts string values to money objects" do
|
64
64
|
car = CarWithCurrency.new
|
65
65
|
car.price = '2'
|
66
|
-
car.price.
|
66
|
+
expect(car.price).to eql(2.to_money)
|
67
67
|
end
|
68
|
-
|
69
|
-
it "
|
68
|
+
|
69
|
+
it "converts to money objects in the correct currency automatically" do
|
70
70
|
car = CarWithNonDefaultCurrency.new
|
71
71
|
car.price = '4'
|
72
|
-
car.price.
|
72
|
+
expect(car.price).to eql(Money.new(400, 'GBP'))
|
73
73
|
end
|
74
74
|
|
75
|
-
it "
|
75
|
+
it "converts numeric values to money objects" do
|
76
76
|
car = Car.new
|
77
77
|
car.price = 3
|
78
|
-
car.price.
|
78
|
+
expect(car.price).to eql(3.to_money)
|
79
79
|
end
|
80
80
|
|
81
81
|
describe "when nil is allowed" do
|
82
|
-
it "
|
82
|
+
it "treats blank values as nil" do
|
83
83
|
car = Car.new
|
84
84
|
car.price = ''
|
85
|
-
car.price.
|
85
|
+
expect(car.price).to be_nil
|
86
86
|
end
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
describe "when nil isn't allowed" do
|
90
|
-
it "
|
90
|
+
it "treats blank values as $0" do
|
91
91
|
car = CarNilNotAllowed.new
|
92
92
|
car.price = ''
|
93
|
-
car.price.
|
93
|
+
expect(car.price).to eql(Money.new(0, 'USD'))
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
-
it "
|
97
|
+
it "allows existing prices to be set to nil with a blank value" do
|
98
98
|
car = Car.new
|
99
99
|
car.price = 500.to_money
|
100
|
-
car.price.
|
100
|
+
expect(car.price).to_not be_nil
|
101
101
|
car.price = ''
|
102
|
-
car.price.
|
102
|
+
expect(car.price).to be_nil
|
103
103
|
end
|
104
104
|
end
|
105
|
-
|
105
|
+
|
106
106
|
describe "declaring a money field" do
|
107
|
-
it "
|
107
|
+
it "allows the field to be declared with a different cents field" do
|
108
108
|
car = CarWithSpecifiedAttribute.new
|
109
109
|
car.price = 5.to_money
|
110
|
-
|
111
|
-
car.
|
110
|
+
|
111
|
+
expect(car.price).to eql(5.to_money)
|
112
|
+
expect(car.amount_in_cents).to eql(5.to_money.cents)
|
112
113
|
end
|
113
114
|
end
|
114
|
-
|
115
|
+
|
115
116
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
$:.unshift File.expand_path('../lib', File.dirname(__FILE__))
|
2
2
|
|
3
|
-
require '
|
4
|
-
require
|
3
|
+
require 'bundler'
|
4
|
+
Bundler.require
|
5
5
|
|
6
6
|
RSpec.configure do |config|
|
7
|
-
config.filter_run :
|
7
|
+
config.filter_run focused: true
|
8
|
+
config.alias_example_to :fit, focused: true
|
8
9
|
config.run_all_when_everything_filtered = true
|
9
|
-
config.alias_example_to :fit, :focused => true
|
10
|
-
config.color_enabled = true
|
11
10
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: money_column
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Klett
|
8
8
|
- Shay Frendt
|
9
9
|
- Nathan Verni
|
10
|
+
- Jeremy W. Rowe
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
@@ -16,16 +17,16 @@ dependencies:
|
|
16
17
|
name: activesupport
|
17
18
|
requirement: !ruby/object:Gem::Requirement
|
18
19
|
requirements:
|
19
|
-
- -
|
20
|
+
- - "~>"
|
20
21
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.2.
|
22
|
+
version: 3.2.19
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
25
|
version_requirements: !ruby/object:Gem::Requirement
|
25
26
|
requirements:
|
26
|
-
- -
|
27
|
+
- - "~>"
|
27
28
|
- !ruby/object:Gem::Version
|
28
|
-
version: 3.2.
|
29
|
+
version: 3.2.19
|
29
30
|
- !ruby/object:Gem::Dependency
|
30
31
|
name: money
|
31
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,79 +59,79 @@ dependencies:
|
|
58
59
|
name: rake
|
59
60
|
requirement: !ruby/object:Gem::Requirement
|
60
61
|
requirements:
|
61
|
-
- - ~>
|
62
|
+
- - "~>"
|
62
63
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
64
|
+
version: 10.3.2
|
64
65
|
type: :development
|
65
66
|
prerelease: false
|
66
67
|
version_requirements: !ruby/object:Gem::Requirement
|
67
68
|
requirements:
|
68
|
-
- - ~>
|
69
|
+
- - "~>"
|
69
70
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
71
|
+
version: 10.3.2
|
71
72
|
- !ruby/object:Gem::Dependency
|
72
73
|
name: rspec
|
73
74
|
requirement: !ruby/object:Gem::Requirement
|
74
75
|
requirements:
|
75
|
-
- - ~>
|
76
|
+
- - "~>"
|
76
77
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
78
|
+
version: 3.0.0
|
78
79
|
type: :development
|
79
80
|
prerelease: false
|
80
81
|
version_requirements: !ruby/object:Gem::Requirement
|
81
82
|
requirements:
|
82
|
-
- - ~>
|
83
|
+
- - "~>"
|
83
84
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
85
|
+
version: 3.0.0
|
85
86
|
- !ruby/object:Gem::Dependency
|
86
87
|
name: guard-rspec
|
87
88
|
requirement: !ruby/object:Gem::Requirement
|
88
89
|
requirements:
|
89
|
-
- - ~>
|
90
|
+
- - "~>"
|
90
91
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
92
|
+
version: 4.2.10
|
92
93
|
type: :development
|
93
94
|
prerelease: false
|
94
95
|
version_requirements: !ruby/object:Gem::Requirement
|
95
96
|
requirements:
|
96
|
-
- - ~>
|
97
|
+
- - "~>"
|
97
98
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
99
|
+
version: 4.2.10
|
99
100
|
- !ruby/object:Gem::Dependency
|
100
101
|
name: growl
|
101
102
|
requirement: !ruby/object:Gem::Requirement
|
102
103
|
requirements:
|
103
|
-
- - ~>
|
104
|
+
- - "~>"
|
104
105
|
- !ruby/object:Gem::Version
|
105
106
|
version: 1.0.3
|
106
107
|
type: :development
|
107
108
|
prerelease: false
|
108
109
|
version_requirements: !ruby/object:Gem::Requirement
|
109
110
|
requirements:
|
110
|
-
- - ~>
|
111
|
+
- - "~>"
|
111
112
|
- !ruby/object:Gem::Version
|
112
113
|
version: 1.0.3
|
113
114
|
- !ruby/object:Gem::Dependency
|
114
115
|
name: rb-fsevent
|
115
116
|
requirement: !ruby/object:Gem::Requirement
|
116
117
|
requirements:
|
117
|
-
- - ~>
|
118
|
+
- - "~>"
|
118
119
|
- !ruby/object:Gem::Version
|
119
|
-
version: 0.4
|
120
|
+
version: 0.9.4
|
120
121
|
type: :development
|
121
122
|
prerelease: false
|
122
123
|
version_requirements: !ruby/object:Gem::Requirement
|
123
124
|
requirements:
|
124
|
-
- - ~>
|
125
|
+
- - "~>"
|
125
126
|
- !ruby/object:Gem::Version
|
126
|
-
version: 0.4
|
127
|
+
version: 0.9.4
|
127
128
|
description: A set of helper methods for working with money-based attributes.
|
128
129
|
email: support@chargify.com
|
129
130
|
executables: []
|
130
131
|
extensions: []
|
131
132
|
extra_rdoc_files: []
|
132
133
|
files:
|
133
|
-
- .gitignore
|
134
|
+
- ".gitignore"
|
134
135
|
- Gemfile
|
135
136
|
- Gemfile.lock
|
136
137
|
- Guardfile
|
@@ -153,17 +154,17 @@ require_paths:
|
|
153
154
|
- lib
|
154
155
|
required_ruby_version: !ruby/object:Gem::Requirement
|
155
156
|
requirements:
|
156
|
-
- -
|
157
|
+
- - ">="
|
157
158
|
- !ruby/object:Gem::Version
|
158
159
|
version: '0'
|
159
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
161
|
requirements:
|
161
|
-
- -
|
162
|
+
- - ">="
|
162
163
|
- !ruby/object:Gem::Version
|
163
164
|
version: '0'
|
164
165
|
requirements: []
|
165
166
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.
|
167
|
+
rubygems_version: 2.2.2
|
167
168
|
signing_key:
|
168
169
|
specification_version: 3
|
169
170
|
summary: A set of helper methods for working with money-based attributes.
|
@@ -171,4 +172,3 @@ test_files:
|
|
171
172
|
- spec/money_column/money_column_spec.rb
|
172
173
|
- spec/spec.opts
|
173
174
|
- spec/spec_helper.rb
|
174
|
-
has_rdoc:
|