corrency 0.3.0 → 0.3.1
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/corrency.gemspec +0 -1
- data/features/{profit_margin_calculations.feature → adding_profit_margin.feature} +0 -0
- data/features/profit_margin_from_price.feature +17 -0
- data/features/step_definitions/{profit_margin_calculations_steps.rb → adding_profit_margin_steps.rb} +0 -0
- data/features/step_definitions/calculate_profit_margin_from_price_steps.rb +11 -0
- data/lib/core_ext/big_decimal.rb +4 -0
- data/lib/corrency/version.rb +1 -1
- metadata +12 -24
data/corrency.gemspec
CHANGED
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Feature: Calculate Profit Margin From Price
|
2
|
+
In order to make the correct amount of profit on an item
|
3
|
+
As a user of the Corrency Library
|
4
|
+
I should be able to work out how much margin has been applied.
|
5
|
+
|
6
|
+
Scenario Outline: Profit Margin from Price
|
7
|
+
Given there is a price of <price>
|
8
|
+
And I know the cost is <cost>
|
9
|
+
Then I should get the margin <margin>
|
10
|
+
|
11
|
+
Examples:
|
12
|
+
| cost | margin | price |
|
13
|
+
| 61.33 | 28% | 85.18 |
|
14
|
+
| 90.00 | 10% | 100.00 |
|
15
|
+
| 100.00 | 20% | 125.00 |
|
16
|
+
| 3.43 | 12.28% | 3.91 |
|
17
|
+
|
data/features/step_definitions/{profit_margin_calculations_steps.rb → adding_profit_margin_steps.rb}
RENAMED
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Given /^there is a price of (.+)$/ do |price|
|
2
|
+
@meh = BigDecimal.new(price)
|
3
|
+
end
|
4
|
+
|
5
|
+
And /^I know the cost is (.+)$/ do |cost|
|
6
|
+
@margin = @meh.margin(cost)
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^I should get the margin (.+)$/ do |margin|
|
10
|
+
assert_equal(BigDecimal.new(margin).to_s, @margin.to_s)
|
11
|
+
end
|
data/lib/core_ext/big_decimal.rb
CHANGED
data/lib/corrency/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: corrency
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -43,22 +43,6 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: shoulda-context
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
46
|
description: Adds Ecommerce Extensions to Various Core Libraries it really does
|
63
47
|
email:
|
64
48
|
- rob@r-williams.com
|
@@ -73,10 +57,12 @@ files:
|
|
73
57
|
- README.md
|
74
58
|
- Rakefile
|
75
59
|
- corrency.gemspec
|
60
|
+
- features/adding_profit_margin.feature
|
76
61
|
- features/nice_rounding.feature
|
77
|
-
- features/
|
62
|
+
- features/profit_margin_from_price.feature
|
63
|
+
- features/step_definitions/adding_profit_margin_steps.rb
|
64
|
+
- features/step_definitions/calculate_profit_margin_from_price_steps.rb
|
78
65
|
- features/step_definitions/nice_rounding_steps.rb
|
79
|
-
- features/step_definitions/profit_margin_calculations_steps.rb
|
80
66
|
- features/step_definitions/vat_calculations_steps.rb
|
81
67
|
- features/support/env.rb
|
82
68
|
- features/vat_calculations.feature
|
@@ -101,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
87
|
version: '0'
|
102
88
|
segments:
|
103
89
|
- 0
|
104
|
-
hash:
|
90
|
+
hash: 4409098266158462653
|
105
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
92
|
none: false
|
107
93
|
requirements:
|
@@ -110,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
96
|
version: '0'
|
111
97
|
segments:
|
112
98
|
- 0
|
113
|
-
hash:
|
99
|
+
hash: 4409098266158462653
|
114
100
|
requirements: []
|
115
101
|
rubyforge_project: corrency
|
116
102
|
rubygems_version: 1.8.24
|
@@ -118,10 +104,12 @@ signing_key:
|
|
118
104
|
specification_version: 3
|
119
105
|
summary: Adds Ecommerce Extensions to Various Core Libraries
|
120
106
|
test_files:
|
107
|
+
- features/adding_profit_margin.feature
|
121
108
|
- features/nice_rounding.feature
|
122
|
-
- features/
|
109
|
+
- features/profit_margin_from_price.feature
|
110
|
+
- features/step_definitions/adding_profit_margin_steps.rb
|
111
|
+
- features/step_definitions/calculate_profit_margin_from_price_steps.rb
|
123
112
|
- features/step_definitions/nice_rounding_steps.rb
|
124
|
-
- features/step_definitions/profit_margin_calculations_steps.rb
|
125
113
|
- features/step_definitions/vat_calculations_steps.rb
|
126
114
|
- features/support/env.rb
|
127
115
|
- features/vat_calculations.feature
|