punchout 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/punchout/fabricator.rb +2 -0
- data/lib/punchout/puncher.rb +6 -0
- data/lib/punchout/puncher/matchables.rb +4 -0
- data/test/integration/punchout/fabricable_test.rb +1 -1
- data/test/integration/punchout_test.rb +19 -1
- data/test/integration/test_helper.rb +2 -4
- data/test/unit/punchout/fabricator_test.rb +1 -1
- data/test/unit/punchout/matcher/ancestry_test.rb +1 -1
- data/test/unit/punchout/matcher/class_test.rb +1 -1
- data/test/unit/punchout/matcher/equal_test.rb +1 -1
- data/test/unit/punchout/matcher/progeny_test.rb +1 -1
- data/test/unit/punchout/matcher_test.rb +1 -1
- data/test/unit/punchout/puncher/matchable_test.rb +1 -1
- data/test/unit/punchout/puncher/matchables_test.rb +6 -1
- data/test/unit/punchout/puncher_test.rb +21 -1
- data/test/unit/punchout_test.rb +1 -1
- data/test/unit/test_helper.rb +2 -5
- metadata +21 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 884d3dcab31235e809deb2c8d3f8779dd2f46dd5
|
4
|
+
data.tar.gz: 298a8d3c298bb1f6b7b406d272d25c0720f5b1be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5785de814f7d0923a21bf4dfb39d704e2d775911ed5af65e086dcb883849828d9f8594011ada36e74c819d611c7f7c56ef4790e4b098acf3b493399b943c0a87
|
7
|
+
data.tar.gz: fb47608dad0bc974f5f81aa45048ff4cf9235b9761ce2d77b2b7834e5a215db4d34651e5124c8ece875bbf3588439dff92a6fcf7109256bb2e95abea5ea1b164
|
data/lib/punchout/fabricator.rb
CHANGED
data/lib/punchout/puncher.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../../test_helper', __FILE__)
|
|
3
3
|
require 'punchout/fabricable'
|
4
4
|
require 'punchout/matcher/class'
|
5
5
|
|
6
|
-
class Punchout::Fabricator::Test <
|
6
|
+
class Punchout::Fabricator::Test < Test::Unit::TestCase
|
7
7
|
class Factory
|
8
8
|
def initialize(pairings)
|
9
9
|
@pairings = pairings
|
@@ -3,7 +3,7 @@ require File.expand_path('../test_helper', __FILE__)
|
|
3
3
|
require 'punchout'
|
4
4
|
require 'punchout/matcher/class'
|
5
5
|
|
6
|
-
class Punchout::Test <
|
6
|
+
class Punchout::Test < Test::Unit::TestCase
|
7
7
|
setup do
|
8
8
|
@punchout_klass = Class.new do
|
9
9
|
include Punchout::Punchable
|
@@ -36,4 +36,22 @@ class Punchout::Test < ActiveSupport::TestCase
|
|
36
36
|
result = puncher.punch(expected_matching_instance)
|
37
37
|
assert_equal expected[:punchable],result
|
38
38
|
end
|
39
|
+
|
40
|
+
test "#all" do
|
41
|
+
punchout = @punchout_klass.new
|
42
|
+
puncher = punchout.puncher
|
43
|
+
|
44
|
+
@pairings.each do |p|
|
45
|
+
matcher = Punchout::Matcher::Klass.new(p[:match])
|
46
|
+
|
47
|
+
matchable = matcher.punches(p[:punchable])
|
48
|
+
|
49
|
+
puncher.add(matchable)
|
50
|
+
end
|
51
|
+
|
52
|
+
expected = @pairings.map {|p| p[:punchable]}
|
53
|
+
|
54
|
+
result = puncher.all
|
55
|
+
assert_equal expected,result
|
56
|
+
end
|
39
57
|
end
|
@@ -3,7 +3,7 @@ require File.expand_path('../../test_helper', __FILE__)
|
|
3
3
|
require 'punchout/fabricator'
|
4
4
|
require 'punchout/puncher'
|
5
5
|
|
6
|
-
class Punchout::FabricatorTest <
|
6
|
+
class Punchout::FabricatorTest < Test::Unit::TestCase
|
7
7
|
setup do
|
8
8
|
@mock_factory = mock
|
9
9
|
@mock_puncher = mock
|
@@ -2,7 +2,7 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|
2
2
|
|
3
3
|
require 'punchout/matcher/ancestry'
|
4
4
|
|
5
|
-
class Punchout::Matcher::AncestryTest <
|
5
|
+
class Punchout::Matcher::AncestryTest < Test::Unit::TestCase
|
6
6
|
setup do
|
7
7
|
@ancestor_klass = Class.new
|
8
8
|
|
@@ -3,7 +3,7 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|
3
3
|
|
4
4
|
require 'punchout/matcher/equal'
|
5
5
|
|
6
|
-
class Punchout::Matcher::EqualTest <
|
6
|
+
class Punchout::Matcher::EqualTest < Test::Unit::TestCase
|
7
7
|
test "#match none" do
|
8
8
|
matcher = Punchout::Matcher::Equal.new("foo")
|
9
9
|
assert_equal false, matcher.matches?("bar")
|
@@ -2,7 +2,7 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|
2
2
|
|
3
3
|
require 'punchout/matcher/progeny'
|
4
4
|
|
5
|
-
class Punchout::Matcher::ProgenyTest <
|
5
|
+
class Punchout::Matcher::ProgenyTest < Test::Unit::TestCase
|
6
6
|
setup do
|
7
7
|
@ancestor_klass = Class.new
|
8
8
|
|
@@ -2,7 +2,7 @@ require File.expand_path('../../test_helper', __FILE__)
|
|
2
2
|
|
3
3
|
require 'punchout/matcher'
|
4
4
|
|
5
|
-
class Punchout::MatcherTest <
|
5
|
+
class Punchout::MatcherTest < Test::Unit::TestCase
|
6
6
|
setup do
|
7
7
|
@mock_subject = mock
|
8
8
|
@matcher = Punchout::Matcher.new(@mock_subject)
|
@@ -2,7 +2,7 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|
2
2
|
|
3
3
|
require 'punchout/puncher/matchable'
|
4
4
|
|
5
|
-
class Punchout::Puncher::MatchableTest <
|
5
|
+
class Punchout::Puncher::MatchableTest < Test::Unit::TestCase
|
6
6
|
test "#matches? true" do
|
7
7
|
mock_matcher = mock
|
8
8
|
mock_thing = mock
|
@@ -2,7 +2,7 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|
2
2
|
|
3
3
|
require 'punchout/puncher/matchables'
|
4
4
|
|
5
|
-
class Punchout::Puncher::MatchablesTest <
|
5
|
+
class Punchout::Puncher::MatchablesTest < Test::Unit::TestCase
|
6
6
|
setup do
|
7
7
|
|
8
8
|
@mock_matchables = 5.times.map {|x|
|
@@ -65,4 +65,9 @@ class Punchout::Puncher::MatchablesTest < ActiveSupport::TestCase
|
|
65
65
|
|
66
66
|
assert_equal @mock_matchables.last, result
|
67
67
|
end
|
68
|
+
|
69
|
+
test '#all' do
|
70
|
+
result = @matchables.all
|
71
|
+
assert_equal @mock_matchables, result
|
72
|
+
end
|
68
73
|
end
|
@@ -2,7 +2,7 @@ require File.expand_path('../../test_helper', __FILE__)
|
|
2
2
|
|
3
3
|
require 'punchout/puncher'
|
4
4
|
|
5
|
-
class Punchout::PuncherTest <
|
5
|
+
class Punchout::PuncherTest < Test::Unit::TestCase
|
6
6
|
setup do
|
7
7
|
|
8
8
|
@mock_matchables = mock
|
@@ -36,4 +36,24 @@ class Punchout::PuncherTest < ActiveSupport::TestCase
|
|
36
36
|
|
37
37
|
assert_equal mock_thing, result
|
38
38
|
end
|
39
|
+
|
40
|
+
test '#all' do
|
41
|
+
mock_things = 5.times.map do
|
42
|
+
mock
|
43
|
+
end
|
44
|
+
|
45
|
+
mock_matchable_arr = mock_things.map do |thing|
|
46
|
+
mock_matchable = mock
|
47
|
+
mock_matchable.expects(:thing).returns(thing)
|
48
|
+
mock_matchable
|
49
|
+
end
|
50
|
+
|
51
|
+
@mock_matchables.expects(:all).returns(mock_matchable_arr)
|
52
|
+
|
53
|
+
@puncher.instance_variable_set(:@matchables, @mock_matchables)
|
54
|
+
|
55
|
+
result = @puncher.all
|
56
|
+
|
57
|
+
assert_equal mock_things, result
|
58
|
+
end
|
39
59
|
end
|
data/test/unit/punchout_test.rb
CHANGED
data/test/unit/test_helper.rb
CHANGED
@@ -5,14 +5,11 @@ Coveralls.wear!
|
|
5
5
|
|
6
6
|
if ENV["ENABLE_SIMPLE_COV"]
|
7
7
|
require 'simplecov'
|
8
|
-
# require File.expand_path('../simplecov_helper', __FILE__)
|
9
8
|
SimpleCov.start do
|
10
9
|
add_filter "test"
|
11
10
|
add_group 'API', "lib"
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
15
|
-
require '
|
16
|
-
require '
|
17
|
-
require 'test/unit'
|
18
|
-
|
14
|
+
require 'test/unit/testcase'
|
15
|
+
require 'mocha/setup'
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: punchout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed Carrel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: test-unit
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
@@ -61,32 +61,32 @@ executables: []
|
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
-
- lib/punchout
|
64
|
+
- lib/punchout.rb
|
65
65
|
- lib/punchout/fabricator.rb
|
66
|
-
- lib/punchout/matcher/ancestry.rb
|
67
|
-
- lib/punchout/matcher/class.rb
|
68
|
-
- lib/punchout/matcher/equal.rb
|
69
|
-
- lib/punchout/matcher/progeny.rb
|
70
|
-
- lib/punchout/matcher.rb
|
71
|
-
- lib/punchout/puncher/matchable/resolver.rb
|
72
66
|
- lib/punchout/puncher/matchable.rb
|
73
67
|
- lib/punchout/puncher/matchables.rb
|
68
|
+
- lib/punchout/puncher/matchable/resolver.rb
|
69
|
+
- lib/punchout/matcher.rb
|
70
|
+
- lib/punchout/matcher/equal.rb
|
71
|
+
- lib/punchout/matcher/class.rb
|
72
|
+
- lib/punchout/matcher/ancestry.rb
|
73
|
+
- lib/punchout/matcher/progeny.rb
|
74
74
|
- lib/punchout/puncher.rb
|
75
|
-
- lib/punchout.rb
|
76
|
-
- test/
|
77
|
-
- test/
|
78
|
-
- test/
|
79
|
-
- test/unit/punchout/
|
75
|
+
- lib/punchout/fabricable.rb
|
76
|
+
- test/unit/punchout_test.rb
|
77
|
+
- test/unit/test_helper.rb
|
78
|
+
- test/unit/punchout/puncher/matchables_test.rb
|
79
|
+
- test/unit/punchout/puncher/matchable_test.rb
|
80
80
|
- test/unit/punchout/matcher/ancestry_test.rb
|
81
|
-
- test/unit/punchout/matcher/class_test.rb
|
82
81
|
- test/unit/punchout/matcher/equal_test.rb
|
82
|
+
- test/unit/punchout/matcher/class_test.rb
|
83
83
|
- test/unit/punchout/matcher/progeny_test.rb
|
84
84
|
- test/unit/punchout/matcher_test.rb
|
85
|
-
- test/unit/punchout/
|
86
|
-
- test/unit/punchout/puncher/matchables_test.rb
|
85
|
+
- test/unit/punchout/fabricator_test.rb
|
87
86
|
- test/unit/punchout/puncher_test.rb
|
88
|
-
- test/
|
89
|
-
- test/
|
87
|
+
- test/integration/punchout_test.rb
|
88
|
+
- test/integration/test_helper.rb
|
89
|
+
- test/integration/punchout/fabricable_test.rb
|
90
90
|
homepage:
|
91
91
|
licenses:
|
92
92
|
- MIT
|
@@ -107,9 +107,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.0.14
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: A flexible registry pattern gem
|
114
114
|
test_files: []
|
115
|
-
has_rdoc:
|