mhennemeyer-matchy 0.2.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -2
- data/lib/matchy/expectation_builder.rb +9 -0
- data/matchy.gemspec +4 -1
- data/test/test_expectation_builder.rb +28 -0
- data/test/test_minitest_compatibility.rb +24 -0
- metadata +4 -1
data/README.rdoc
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
= matchy
|
2
2
|
|
3
|
-
* http://github.com/
|
3
|
+
* http://github.com/jeremymcanally/matchy
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
|
-
A 300loc refactoring of Jeremy Mcanally's Matchy. Original Description:
|
7
6
|
Hate writing assertions? Need a little behavior-driven love in your tests? Then matchy is for you.
|
8
7
|
|
9
8
|
== FEATURES/PROBLEMS:
|
data/matchy.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "matchy"
|
3
|
-
s.version = "0.
|
3
|
+
s.version = "0.3.1"
|
4
4
|
s.date = "2009-02-08"
|
5
5
|
s.summary = "RSpec-esque matchers for use in Test::Unit"
|
6
6
|
s.email = "mhennemeyer@gmail.com"
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
"config/requirements.rb",
|
24
24
|
"lib/matchy.rb",
|
25
25
|
"lib/matchy/version.rb",
|
26
|
+
"lib/matchy/expectation_builder.rb",
|
26
27
|
"lib/matchy/modals.rb",
|
27
28
|
"lib/matchy/def_matcher.rb",
|
28
29
|
"lib/matchy/matcher_builder.rb",
|
@@ -36,6 +37,8 @@ Gem::Specification.new do |s|
|
|
36
37
|
|
37
38
|
s.test_files = [
|
38
39
|
"test/test_change_expectation.rb",
|
40
|
+
"test/test_expectation_builder.rb",
|
41
|
+
"test/test_minitest_compatibility.rb",
|
39
42
|
"test/test_def_matcher.rb",
|
40
43
|
"test/test_enumerable_expectations.rb",
|
41
44
|
"test/test_error_expectations.rb",
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestExpectationBuilder < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@obj = Object.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_should
|
10
|
+
exp = Matchy::ExpectationBuilder.build_expectation(true, nil, @obj)
|
11
|
+
exp.send(:==, @obj)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_should_fails
|
15
|
+
expect_1 = Matchy::ExpectationBuilder.build_expectation(true, nil, 1)
|
16
|
+
lambda {expect_1.send(:==, 2)}.should raise_error
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_should_not
|
20
|
+
exp = Matchy::ExpectationBuilder.build_expectation(false, nil, @obj)
|
21
|
+
exp.send(:==, 1)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_should_not_fails
|
25
|
+
expect_not_1 = Matchy::ExpectationBuilder.build_expectation(false, nil, 1)
|
26
|
+
lambda {expect_not_1.send(:==, 1)}.should raise_error
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'minitest/unit'
|
3
|
+
load File.dirname(__FILE__) + '/../lib/matchy.rb'
|
4
|
+
|
5
|
+
MiniTest::Unit.autorun
|
6
|
+
|
7
|
+
class TestAThing < MiniTest::Unit::TestCase
|
8
|
+
def test_equal_equal
|
9
|
+
1.should == 1
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_equal_equal_fails
|
13
|
+
#1.should == 2
|
14
|
+
lambda{ 1.should == 2 }.should raise_error
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_equal_equal_negative
|
18
|
+
1.should_not == 2
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_equal_equal_negative_fails
|
22
|
+
lambda{ 1.should_not == 1 }.should raise_error
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mhennemeyer-matchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy McAnally
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- config/requirements.rb
|
37
37
|
- lib/matchy.rb
|
38
38
|
- lib/matchy/version.rb
|
39
|
+
- lib/matchy/expectation_builder.rb
|
39
40
|
- lib/matchy/modals.rb
|
40
41
|
- lib/matchy/def_matcher.rb
|
41
42
|
- lib/matchy/matcher_builder.rb
|
@@ -74,6 +75,8 @@ specification_version: 2
|
|
74
75
|
summary: RSpec-esque matchers for use in Test::Unit
|
75
76
|
test_files:
|
76
77
|
- test/test_change_expectation.rb
|
78
|
+
- test/test_expectation_builder.rb
|
79
|
+
- test/test_minitest_compatibility.rb
|
77
80
|
- test/test_def_matcher.rb
|
78
81
|
- test/test_enumerable_expectations.rb
|
79
82
|
- test/test_error_expectations.rb
|