zillion 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/lib/zillion/mapper.rb +6 -0
- data/spec/mapper_spec.rb +14 -0
- data/zillion.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8276136e7e27c0603ec082e51760f7a554b4b01c
|
4
|
+
data.tar.gz: 53a3b14a5e67fac2d7e594930a6c9fc4e4039398
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fb31ace43c7617b33d2521bb67675d9fa4748cf46923e49ead862546aa6611169bb5a1da0ceeae1817d3ff72e2947d8cd3226ae432fba9d8cd0400fdf62bb9e
|
7
|
+
data.tar.gz: 9f0964b5a4412bc0afa34217eb9f9b1173ca1a79dcfdf7ac9f92e127498e45766be55c4e794e613b277fd791bed93634f0124d99f9cfc56895f41fc0857cf187
|
data/lib/zillion/mapper.rb
CHANGED
@@ -65,6 +65,12 @@ class PlanFinder
|
|
65
65
|
sorted_available_plans.first
|
66
66
|
end
|
67
67
|
|
68
|
+
def best_plan_excluding(*plan_list)
|
69
|
+
return nil if available_plans.empty?
|
70
|
+
list = sorted_available_plans.select { |plan| !plan_list.include?(plan.key.to_s) }
|
71
|
+
list.first
|
72
|
+
end
|
73
|
+
|
68
74
|
def monthly_fee_for_best_plan
|
69
75
|
best_plan.monthly_fee_for(@counts)
|
70
76
|
end
|
data/spec/mapper_spec.rb
CHANGED
@@ -124,4 +124,18 @@ describe 'PlanFinder' do
|
|
124
124
|
|
125
125
|
end
|
126
126
|
|
127
|
+
describe '#best_plan_excluding' do
|
128
|
+
|
129
|
+
it 'returns nil if over all limits' do
|
130
|
+
finder = PlanFinder.init(mapper).new({ products: 250 })
|
131
|
+
expect(finder.best_plan_excluding('small')).to eql(nil)
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'returns lower plan exluding the one in list, if under the lowest limit' do
|
135
|
+
finder = PlanFinder.init(mapper).new({ products: 50 })
|
136
|
+
expect(finder.best_plan_excluding('small')).to eql(mapper.get(:medium))
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
140
|
+
|
127
141
|
end
|
data/zillion.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zillion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomás Pollak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|