drawy 0.0.2 → 0.0.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.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/drawy-0.0.2.gem +0 -0
- data/lib/drawy/validator.rb +2 -0
- data/lib/drawy/version.rb +1 -1
- data/test/test_validator.rb +7 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a6af40ffa77462542b49e06c055f956a46b1555
|
4
|
+
data.tar.gz: cdd560b06c2ab24a8f6e98eeef936caf187af5d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 444b2be0f6275212399f6cf5f7ee4ae9ed9719ed1f2ecd9d347a0529f297ee81134f01b75bde8d63b58d15d3088f1251326847e5f8fa34c319e21c5b156855e0
|
7
|
+
data.tar.gz: 174c35ae4484259c977b5b0673d30b0bc30c2bd60799aae30f789e5c361ff56ac48d11a3f530ac79302992a1e5951b245cbaacf8ca8e3bfa2fc62ee6583e81f3
|
data/README.md
CHANGED
data/drawy-0.0.2.gem
ADDED
Binary file
|
data/lib/drawy/validator.rb
CHANGED
@@ -12,6 +12,8 @@ module Drawy
|
|
12
12
|
people = Drawy::Engine.people
|
13
13
|
if people.nil? || people.empty? || people.size < 2
|
14
14
|
raise Drawy::ValidationError, 'You must register at least 2 people or couples before drawing'
|
15
|
+
elsif people.size == 2 && Drawy::Engine.is_couple?(people[0], people[1])
|
16
|
+
raise Drawy::ValidationError, 'The current pool only contains a couple, please add more people'
|
15
17
|
# A couple plus one person creates a triangle making the distribution impossible given the rules
|
16
18
|
# We either end up with one person in couple buying a gift for its partner or the 3rd
|
17
19
|
# person receiving 2 gifts and someone receiving none
|
data/lib/drawy/version.rb
CHANGED
data/test/test_validator.rb
CHANGED
@@ -31,12 +31,18 @@ class TestValidator < Minitest::Test
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
Drawy::Engine.people = %w(john anna
|
34
|
+
Drawy::Engine.people = %w(john anna)
|
35
35
|
Drawy::Engine.couples = { 'john' => 'anna' }
|
36
36
|
|
37
37
|
assert_raises Drawy::ValidationError do
|
38
38
|
Drawy::Validator.validate_people_format
|
39
39
|
end
|
40
|
+
|
41
|
+
Drawy::Engine.people += ['dan']
|
42
|
+
|
43
|
+
assert_raises Drawy::ValidationError do
|
44
|
+
Drawy::Validator.validate_people_format
|
45
|
+
end
|
40
46
|
end
|
41
47
|
|
42
48
|
def test_couple_plus_one?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drawy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil Rosenstech
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- Rakefile
|
70
70
|
- bin/drawy
|
71
71
|
- drawy-0.0.1.gem
|
72
|
+
- drawy-0.0.2.gem
|
72
73
|
- drawy.gemspec
|
73
74
|
- lib/drawy.rb
|
74
75
|
- lib/drawy/application.rb
|