acts_as_price 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +4 -1
- data/Rakefile +10 -10
- data/VERSION +1 -1
- data/acts_as_price.gemspec +8 -6
- data/rdoc/created.rid +1 -1
- data/rdoc/files/README_rdoc.html +7 -4
- data/spec/{car_spec.rb → advanced_tests/car_spec.rb} +1 -1
- data/spec/{fueltype_spec.rb → advanced_tests/fueltype_spec.rb} +1 -1
- data/spec/simple_tests/car_and_fueltype_spec.rb +76 -0
- metadata +37 -35
data/README.rdoc
CHANGED
|
@@ -58,7 +58,10 @@ Now you may add the following code to your spec-files for your models:
|
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
=TESTING
|
|
61
|
-
To test the plugin use the command '
|
|
61
|
+
To test the plugin use the command 'rspec spec/**' inside the dir '~/vendor/plugins/acts_as_price'
|
|
62
|
+
|
|
63
|
+
=KNOWN BUGS
|
|
64
|
+
The command 'rake test' is not running properly at the moment.
|
|
62
65
|
|
|
63
66
|
=NOTES
|
|
64
67
|
This plugin comes with Rspec tests.
|
data/Rakefile
CHANGED
|
@@ -4,16 +4,16 @@ require 'rake'
|
|
|
4
4
|
require 'rake/testtask'
|
|
5
5
|
require 'rake/rdoctask'
|
|
6
6
|
|
|
7
|
-
desc 'Default: run unit tests.'
|
|
8
|
-
task :default => :test
|
|
9
|
-
|
|
10
|
-
desc 'Test the acts_as_price plugin.'
|
|
11
|
-
Rake::TestTask.new(:test) do |t|
|
|
12
|
-
t.libs << 'lib'
|
|
13
|
-
t.libs << 'spec'
|
|
14
|
-
t.pattern = 'spec
|
|
15
|
-
t.verbose = true
|
|
16
|
-
end
|
|
7
|
+
#desc 'Default: run unit tests.'
|
|
8
|
+
#task :default => :test
|
|
9
|
+
#
|
|
10
|
+
#desc 'Test the acts_as_price plugin.'
|
|
11
|
+
#Rake::TestTask.new(:test) do |t|
|
|
12
|
+
# t.libs << 'lib'
|
|
13
|
+
# t.libs << 'spec'
|
|
14
|
+
# t.pattern = 'spec/**/*spec.rb'
|
|
15
|
+
# t.verbose = true
|
|
16
|
+
#end
|
|
17
17
|
|
|
18
18
|
desc 'Generate documentation for the acts_as_price plugin.'
|
|
19
19
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.3
|
data/acts_as_price.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{acts_as_price}
|
|
8
|
-
s.version = "0.1.
|
|
8
|
+
s.version = "0.1.3"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Jeroen van Ingen"]
|
|
12
|
-
s.date = %q{2011-
|
|
12
|
+
s.date = %q{2011-05-01}
|
|
13
13
|
s.description = %q{A specified database column acts as a price and creates on the fly methods like 'price' and 'price_in_cents'. For more information visit: http://github.com/jeroeningen/acts_as_price}
|
|
14
14
|
s.email = %q{jeroeningen@gmail.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -40,10 +40,11 @@ Gem::Specification.new do |s|
|
|
|
40
40
|
"rdoc/fr_method_index.html",
|
|
41
41
|
"rdoc/index.html",
|
|
42
42
|
"rdoc/rdoc-style.css",
|
|
43
|
-
"spec/car_spec.rb",
|
|
44
|
-
"spec/fueltype_spec.rb",
|
|
43
|
+
"spec/advanced_tests/car_spec.rb",
|
|
44
|
+
"spec/advanced_tests/fueltype_spec.rb",
|
|
45
45
|
"spec/models/car.rb",
|
|
46
46
|
"spec/models/fueltype.rb",
|
|
47
|
+
"spec/simple_tests/car_and_fueltype_spec.rb",
|
|
47
48
|
"spec/spec_helper.rb",
|
|
48
49
|
"uninstall.rb"
|
|
49
50
|
]
|
|
@@ -53,10 +54,11 @@ Gem::Specification.new do |s|
|
|
|
53
54
|
s.rubygems_version = %q{1.3.7}
|
|
54
55
|
s.summary = %q{A specified database column acts as a price}
|
|
55
56
|
s.test_files = [
|
|
56
|
-
"spec/car_spec.rb",
|
|
57
|
-
"spec/fueltype_spec.rb",
|
|
57
|
+
"spec/advanced_tests/car_spec.rb",
|
|
58
|
+
"spec/advanced_tests/fueltype_spec.rb",
|
|
58
59
|
"spec/models/car.rb",
|
|
59
60
|
"spec/models/fueltype.rb",
|
|
61
|
+
"spec/simple_tests/car_and_fueltype_spec.rb",
|
|
60
62
|
"spec/spec_helper.rb"
|
|
61
63
|
]
|
|
62
64
|
|
data/rdoc/created.rid
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Sun, 01 May 2011 07:33:52 -0700
|
data/rdoc/files/README_rdoc.html
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
</tr>
|
|
57
57
|
<tr class="top-aligned-row">
|
|
58
58
|
<td><strong>Last Update:</strong></td>
|
|
59
|
-
<td>
|
|
59
|
+
<td>Sun May 01 07:30:16 -0700 2011</td>
|
|
60
60
|
</tr>
|
|
61
61
|
</table>
|
|
62
62
|
</div>
|
|
@@ -178,9 +178,12 @@ Now you may add the following code to your spec-files for your models:
|
|
|
178
178
|
</pre>
|
|
179
179
|
<h1>TESTING</h1>
|
|
180
180
|
<p>
|
|
181
|
-
To test the plugin use the command ‘
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
To test the plugin use the command ‘rspec spec/**’ inside the
|
|
182
|
+
dir ’~/vendor/plugins/acts_as_price‘
|
|
183
|
+
</p>
|
|
184
|
+
<h1>KNOWN BUGS</h1>
|
|
185
|
+
<p>
|
|
186
|
+
The command ‘rake test’ is not running properly at the moment.
|
|
184
187
|
</p>
|
|
185
188
|
<h1>NOTES</h1>
|
|
186
189
|
<p>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
require File.expand_path("../../spec_helper", __FILE__)
|
|
2
|
+
|
|
3
|
+
#Car return the price as a comma seperated value
|
|
4
|
+
describe Car do
|
|
5
|
+
context "adding a price as comma seperated value" do
|
|
6
|
+
it "should return the price as comma-seperated value" do
|
|
7
|
+
car = stub_model(Car, :price => "23000,59")
|
|
8
|
+
car.price.should == "23000,59"
|
|
9
|
+
end
|
|
10
|
+
it "should return the pricce in cents" do
|
|
11
|
+
car = stub_model(Car, :price => "23000,59")
|
|
12
|
+
car.price_in_cents.should == 2300059
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "adding the price as a dot seperated value" do
|
|
17
|
+
it "should return the price as a comma seperated value" do
|
|
18
|
+
car = stub_model(Car, :price => "23000.59")
|
|
19
|
+
car.price.should == "23000,59"
|
|
20
|
+
car = stub_model(Car, :price => "23000.5")
|
|
21
|
+
car.price.should == "23000,50"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
context "adding the price as an integer" do
|
|
26
|
+
it "should return the price as a comma-seperated value" do
|
|
27
|
+
car = stub_model(Car, :price => "23000")
|
|
28
|
+
car.price.should == "23000,00"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
#Fueltype returns the price as a dot seperated value
|
|
34
|
+
describe Fueltype do
|
|
35
|
+
context "adding the price as an comma sewperated value" do
|
|
36
|
+
it "should return the price as a dot seperated value" do
|
|
37
|
+
fueltype = stub_model(Fueltype, :price_per_liter => "1,59")
|
|
38
|
+
fueltype.price.should == "1.59"
|
|
39
|
+
fueltype.price_per_liter.should == "1.59"
|
|
40
|
+
end
|
|
41
|
+
it "should return the price in cents" do
|
|
42
|
+
fueltype = stub_model(Fueltype, :price_per_liter => "1,59")
|
|
43
|
+
fueltype.price_per_liter_in_cents.should == 159
|
|
44
|
+
fueltype.price_in_cents.should == 159
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
context "adding the price as a dot seperated value" do
|
|
49
|
+
it "should return the price as a dot seperated value" do
|
|
50
|
+
fueltype = stub_model(Fueltype, :price_per_liter => "1.59")
|
|
51
|
+
fueltype.price_per_liter.should == "1.59"
|
|
52
|
+
fueltype.price.should == "1.59"
|
|
53
|
+
fueltype = stub_model(Fueltype, :price_per_liter => "1,5")
|
|
54
|
+
fueltype.price_per_liter.should == "1.50"
|
|
55
|
+
fueltype.price.should == "1.50"
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
context "adding the price as an integer" do
|
|
60
|
+
it "should return the price as a dot seperated value" do
|
|
61
|
+
fueltype = stub_model(Fueltype, :price_per_liter => "1")
|
|
62
|
+
fueltype.price_per_liter.should == "1.00"
|
|
63
|
+
fueltype.price.should == "1.00"
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
context "adding a price that could give a floating point problem" do
|
|
68
|
+
it "should return the right prices" do
|
|
69
|
+
fueltype = stub_model(Fueltype, :price_per_liter => "2,05")
|
|
70
|
+
fueltype.price.should == "2.05"
|
|
71
|
+
fueltype.price_per_liter.should == "2.05"
|
|
72
|
+
fueltype.price_in_cents.should == 205
|
|
73
|
+
fueltype.price_per_liter_in_cents.should == 205
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: acts_as_price
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 29
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 1
|
|
9
|
-
-
|
|
10
|
-
version: 0.1.
|
|
9
|
+
- 3
|
|
10
|
+
version: 0.1.3
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Jeroen van Ingen
|
|
@@ -15,12 +15,13 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-
|
|
18
|
+
date: 2011-05-01 00:00:00 -07:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
22
|
+
type: :runtime
|
|
22
23
|
name: rails
|
|
23
|
-
|
|
24
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
|
24
25
|
none: false
|
|
25
26
|
requirements:
|
|
26
27
|
- - "="
|
|
@@ -31,12 +32,12 @@ dependencies:
|
|
|
31
32
|
- 0
|
|
32
33
|
- 7
|
|
33
34
|
version: 3.0.7
|
|
35
|
+
requirement: *id001
|
|
34
36
|
prerelease: false
|
|
35
|
-
type: :runtime
|
|
36
|
-
version_requirements: *id001
|
|
37
37
|
- !ruby/object:Gem::Dependency
|
|
38
|
+
type: :development
|
|
38
39
|
name: jeweler
|
|
39
|
-
|
|
40
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
|
40
41
|
none: false
|
|
41
42
|
requirements:
|
|
42
43
|
- - ~>
|
|
@@ -47,12 +48,12 @@ dependencies:
|
|
|
47
48
|
- 5
|
|
48
49
|
- 2
|
|
49
50
|
version: 1.5.2
|
|
51
|
+
requirement: *id002
|
|
50
52
|
prerelease: false
|
|
51
|
-
type: :development
|
|
52
|
-
version_requirements: *id002
|
|
53
53
|
- !ruby/object:Gem::Dependency
|
|
54
|
+
type: :runtime
|
|
54
55
|
name: rails
|
|
55
|
-
|
|
56
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
|
56
57
|
none: false
|
|
57
58
|
requirements:
|
|
58
59
|
- - "="
|
|
@@ -63,12 +64,12 @@ dependencies:
|
|
|
63
64
|
- 0
|
|
64
65
|
- 7
|
|
65
66
|
version: 3.0.7
|
|
67
|
+
requirement: *id003
|
|
66
68
|
prerelease: false
|
|
67
|
-
type: :runtime
|
|
68
|
-
version_requirements: *id003
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
|
+
type: :development
|
|
70
71
|
name: rspec-rails
|
|
71
|
-
|
|
72
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
|
72
73
|
none: false
|
|
73
74
|
requirements:
|
|
74
75
|
- - "="
|
|
@@ -79,12 +80,12 @@ dependencies:
|
|
|
79
80
|
- 5
|
|
80
81
|
- 0
|
|
81
82
|
version: 2.5.0
|
|
83
|
+
requirement: *id004
|
|
82
84
|
prerelease: false
|
|
83
|
-
type: :development
|
|
84
|
-
version_requirements: *id004
|
|
85
85
|
- !ruby/object:Gem::Dependency
|
|
86
|
+
type: :development
|
|
86
87
|
name: shoulda-matchers
|
|
87
|
-
|
|
88
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
|
88
89
|
none: false
|
|
89
90
|
requirements:
|
|
90
91
|
- - "="
|
|
@@ -96,12 +97,12 @@ dependencies:
|
|
|
96
97
|
- 0
|
|
97
98
|
- beta2
|
|
98
99
|
version: 1.0.0.beta2
|
|
100
|
+
requirement: *id005
|
|
99
101
|
prerelease: false
|
|
100
|
-
type: :development
|
|
101
|
-
version_requirements: *id005
|
|
102
102
|
- !ruby/object:Gem::Dependency
|
|
103
|
+
type: :development
|
|
103
104
|
name: autotest
|
|
104
|
-
|
|
105
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
|
105
106
|
none: false
|
|
106
107
|
requirements:
|
|
107
108
|
- - "="
|
|
@@ -112,12 +113,12 @@ dependencies:
|
|
|
112
113
|
- 4
|
|
113
114
|
- 6
|
|
114
115
|
version: 4.4.6
|
|
116
|
+
requirement: *id006
|
|
115
117
|
prerelease: false
|
|
116
|
-
type: :development
|
|
117
|
-
version_requirements: *id006
|
|
118
118
|
- !ruby/object:Gem::Dependency
|
|
119
|
+
type: :development
|
|
119
120
|
name: rcov
|
|
120
|
-
|
|
121
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
|
121
122
|
none: false
|
|
122
123
|
requirements:
|
|
123
124
|
- - "="
|
|
@@ -128,12 +129,12 @@ dependencies:
|
|
|
128
129
|
- 9
|
|
129
130
|
- 9
|
|
130
131
|
version: 0.9.9
|
|
132
|
+
requirement: *id007
|
|
131
133
|
prerelease: false
|
|
132
|
-
type: :development
|
|
133
|
-
version_requirements: *id007
|
|
134
134
|
- !ruby/object:Gem::Dependency
|
|
135
|
+
type: :development
|
|
135
136
|
name: metrical
|
|
136
|
-
|
|
137
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
|
137
138
|
none: false
|
|
138
139
|
requirements:
|
|
139
140
|
- - "="
|
|
@@ -144,12 +145,12 @@ dependencies:
|
|
|
144
145
|
- 0
|
|
145
146
|
- 5
|
|
146
147
|
version: 0.0.5
|
|
148
|
+
requirement: *id008
|
|
147
149
|
prerelease: false
|
|
148
|
-
type: :development
|
|
149
|
-
version_requirements: *id008
|
|
150
150
|
- !ruby/object:Gem::Dependency
|
|
151
|
+
type: :development
|
|
151
152
|
name: activerecord-nulldb-adapter
|
|
152
|
-
|
|
153
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
|
153
154
|
none: false
|
|
154
155
|
requirements:
|
|
155
156
|
- - "="
|
|
@@ -160,9 +161,8 @@ dependencies:
|
|
|
160
161
|
- 2
|
|
161
162
|
- 1
|
|
162
163
|
version: 0.2.1
|
|
164
|
+
requirement: *id009
|
|
163
165
|
prerelease: false
|
|
164
|
-
type: :development
|
|
165
|
-
version_requirements: *id009
|
|
166
166
|
description: "A specified database column acts as a price and creates on the fly methods like 'price' and 'price_in_cents'. For more information visit: http://github.com/jeroeningen/acts_as_price"
|
|
167
167
|
email: jeroeningen@gmail.com
|
|
168
168
|
executables: []
|
|
@@ -196,10 +196,11 @@ files:
|
|
|
196
196
|
- rdoc/fr_method_index.html
|
|
197
197
|
- rdoc/index.html
|
|
198
198
|
- rdoc/rdoc-style.css
|
|
199
|
-
- spec/car_spec.rb
|
|
200
|
-
- spec/fueltype_spec.rb
|
|
199
|
+
- spec/advanced_tests/car_spec.rb
|
|
200
|
+
- spec/advanced_tests/fueltype_spec.rb
|
|
201
201
|
- spec/models/car.rb
|
|
202
202
|
- spec/models/fueltype.rb
|
|
203
|
+
- spec/simple_tests/car_and_fueltype_spec.rb
|
|
203
204
|
- spec/spec_helper.rb
|
|
204
205
|
- uninstall.rb
|
|
205
206
|
has_rdoc: true
|
|
@@ -237,8 +238,9 @@ signing_key:
|
|
|
237
238
|
specification_version: 3
|
|
238
239
|
summary: A specified database column acts as a price
|
|
239
240
|
test_files:
|
|
240
|
-
- spec/car_spec.rb
|
|
241
|
-
- spec/fueltype_spec.rb
|
|
241
|
+
- spec/advanced_tests/car_spec.rb
|
|
242
|
+
- spec/advanced_tests/fueltype_spec.rb
|
|
242
243
|
- spec/models/car.rb
|
|
243
244
|
- spec/models/fueltype.rb
|
|
245
|
+
- spec/simple_tests/car_and_fueltype_spec.rb
|
|
244
246
|
- spec/spec_helper.rb
|