mcmire-matchy 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
- class TestMatcherBuilder < Test::Unit::TestCase
3
+ class TestMatcherBuilder < Matchy.test_case_class
4
4
  include Matchy::MatcherBuilder
5
5
 
6
6
  def setup
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
- class TestModals < Test::Unit::TestCase
3
+ class TestModals < Matchy.test_case_class
4
4
  def setup
5
5
  @expectation = build_matcher() {|r,m,a| true}
6
6
  @bad_expectation = build_matcher() {|r,m,a| false}
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
- class TestOperatorExpectations < Test::Unit::TestCase
3
+ class TestOperatorExpectations < Matchy.test_case_class
4
4
  # EQUALS (==)
5
5
  def test_equals
6
6
  3.should == 3
@@ -9,7 +9,7 @@ class TestOperatorExpectations < Test::Unit::TestCase
9
9
  def test_equals_fails
10
10
  lambda {
11
11
  3.should == 5
12
- }.should raise_error(Test::Unit::AssertionFailedError)
12
+ }.should raise_error(Matchy.assertion_failed_error)
13
13
  end
14
14
 
15
15
  def test_negative_equals
@@ -19,7 +19,7 @@ class TestOperatorExpectations < Test::Unit::TestCase
19
19
  def test_negative_equals_fails
20
20
  lambda {
21
21
  3.should_not == 3
22
- }.should raise_error(Test::Unit::AssertionFailedError)
22
+ }.should raise_error(Matchy.assertion_failed_error)
23
23
  end
24
24
 
25
25
  # LESS THAN (<)
@@ -30,7 +30,7 @@ class TestOperatorExpectations < Test::Unit::TestCase
30
30
  def test_less_than_fails
31
31
  lambda {
32
32
  4.should < 3
33
- }.should raise_error(Test::Unit::AssertionFailedError)
33
+ }.should raise_error(Matchy.assertion_failed_error)
34
34
  end
35
35
 
36
36
  def test_less_than_equals
@@ -40,7 +40,7 @@ class TestOperatorExpectations < Test::Unit::TestCase
40
40
  def test_negative_less_than_fails
41
41
  lambda {
42
42
  4.should_not < 5
43
- }.should raise_error(Test::Unit::AssertionFailedError)
43
+ }.should raise_error(Matchy.assertion_failed_error)
44
44
  end
45
45
 
46
46
  # GREATER THAN (>)
@@ -51,7 +51,7 @@ class TestOperatorExpectations < Test::Unit::TestCase
51
51
  def test_greater_than_fails
52
52
  lambda {
53
53
  4.should > 5
54
- }.should raise_error(Test::Unit::AssertionFailedError)
54
+ }.should raise_error(Matchy.assertion_failed_error)
55
55
  end
56
56
 
57
57
  def test_greater_than_equals
@@ -61,7 +61,7 @@ class TestOperatorExpectations < Test::Unit::TestCase
61
61
  def test_negative_greater_than_fails
62
62
  lambda {
63
63
  4.should_not > 3
64
- }.should raise_error(Test::Unit::AssertionFailedError)
64
+ }.should raise_error(Matchy.assertion_failed_error)
65
65
  end
66
66
 
67
67
  # LESS THAN EQUAL (<=)
@@ -76,7 +76,7 @@ class TestOperatorExpectations < Test::Unit::TestCase
76
76
  def test_less_than_equal_fails
77
77
  lambda {
78
78
  4.should <= 3
79
- }.should raise_error(Test::Unit::AssertionFailedError)
79
+ }.should raise_error(Matchy.assertion_failed_error)
80
80
  end
81
81
 
82
82
  def test_negative_less_than_equal
@@ -86,7 +86,7 @@ class TestOperatorExpectations < Test::Unit::TestCase
86
86
  def test_negative_less_than_equal_fails
87
87
  lambda {
88
88
  4.should_not <= 5
89
- }.should raise_error(Test::Unit::AssertionFailedError)
89
+ }.should raise_error(Matchy.assertion_failed_error)
90
90
  end
91
91
 
92
92
  # GREATER THAN EQUALS (>=)
@@ -101,7 +101,7 @@ class TestOperatorExpectations < Test::Unit::TestCase
101
101
  def test_greater_than_equal_fails
102
102
  lambda {
103
103
  4.should >= 5
104
- }.should raise_error(Test::Unit::AssertionFailedError)
104
+ }.should raise_error(Matchy.assertion_failed_error)
105
105
  end
106
106
 
107
107
  def test_negative_greater_than_equal_equals
@@ -111,7 +111,7 @@ class TestOperatorExpectations < Test::Unit::TestCase
111
111
  def test_negative_greater_than_equal_fails
112
112
  lambda {
113
113
  4.should_not >= 3
114
- }.should raise_error(Test::Unit::AssertionFailedError)
114
+ }.should raise_error(Matchy.assertion_failed_error)
115
115
  end
116
116
 
117
117
  # MATCHES (=~)
@@ -122,7 +122,7 @@ class TestOperatorExpectations < Test::Unit::TestCase
122
122
  def test_matches_fails
123
123
  lambda {
124
124
  "d00d ur 1337".should =~ /world/
125
- }.should raise_error(Test::Unit::AssertionFailedError)
125
+ }.should raise_error(Matchy.assertion_failed_error)
126
126
  end
127
127
 
128
128
  def test_negative_matches
@@ -132,7 +132,7 @@ class TestOperatorExpectations < Test::Unit::TestCase
132
132
  def test_negative_matches_fails
133
133
  lambda {
134
134
  "it's a freak out!".should_not =~ /freak/
135
- }.should raise_error(Test::Unit::AssertionFailedError)
135
+ }.should raise_error(Matchy.assertion_failed_error)
136
136
  end
137
137
 
138
138
  def test_fail_message
@@ -156,12 +156,13 @@ class TestOperatorExpectations < Test::Unit::TestCase
156
156
  end
157
157
 
158
158
  def test_fail_message_for_hash
159
- obj = Matchy::Expectations::OperatorExpectation.new({:foo => 'bar', :baz => 'quux'}, true)
159
+ hash = {:foo => 'bar', :baz => 'quux'}
160
+ obj = Matchy::Expectations::OperatorExpectation.new(hash, true)
160
161
 
161
162
  def obj.flunk(msg)
162
163
  msg
163
164
  end
164
165
 
165
- (obj == {:foo => 'bar'}).should == "Expected {:baz=>\"quux\", :foo=>\"bar\"} to == {:foo=>\"bar\"} (diff: {:baz=>\"quux\"})."
166
+ (obj == {:foo => 'bar'}).should == "Expected #{hash.inspect} to == {:foo=>\"bar\"} (diff: {:baz=>\"quux\"})."
166
167
  end
167
168
  end
@@ -10,7 +10,7 @@ class Exister
10
10
  end
11
11
  end
12
12
 
13
- class TestTruthExpectations < Test::Unit::TestCase
13
+ class TestTruthExpectations < Matchy.test_case_class
14
14
 
15
15
  def setup
16
16
  @obj = Object.new
@@ -29,13 +29,13 @@ class TestTruthExpectations < Test::Unit::TestCase
29
29
  def test_equal_fail
30
30
  lambda {
31
31
  3.should equal(4)
32
- }.should raise_error(Test::Unit::AssertionFailedError)
32
+ }.should raise_error(Matchy.assertion_failed_error)
33
33
  end
34
34
 
35
35
  def test_negative_equal_fail
36
36
  lambda {
37
37
  3.should_not equal(3)
38
- }.should raise_error(Test::Unit::AssertionFailedError)
38
+ }.should raise_error(Matchy.assertion_failed_error)
39
39
  end
40
40
 
41
41
  def test_eql
@@ -53,13 +53,13 @@ class TestTruthExpectations < Test::Unit::TestCase
53
53
  def test_eql_fail
54
54
  lambda {
55
55
  3.should eql(13)
56
- }.should raise_error(Test::Unit::AssertionFailedError)
56
+ }.should raise_error(Matchy.assertion_failed_error)
57
57
  end
58
58
 
59
59
  def test_negative_eql_fail
60
60
  lambda {
61
61
  3.should_not eql(3)
62
- }.should raise_error(Test::Unit::AssertionFailedError)
62
+ }.should raise_error(Matchy.assertion_failed_error)
63
63
  end
64
64
 
65
65
  def test_exists
@@ -76,14 +76,14 @@ class TestTruthExpectations < Test::Unit::TestCase
76
76
  lambda {
77
77
  thing = Exister.new(false)
78
78
  thing.should exist
79
- }.should raise_error(Test::Unit::AssertionFailedError)
79
+ }.should raise_error(Matchy.assertion_failed_error)
80
80
  end
81
81
 
82
82
  def test_negative_exists_fail
83
83
  lambda {
84
84
  thing = Exister.new(true)
85
85
  thing.should_not exist
86
- }.should raise_error(Test::Unit::AssertionFailedError)
86
+ }.should raise_error(Matchy.assertion_failed_error)
87
87
  end
88
88
 
89
89
  def test_be
@@ -101,7 +101,7 @@ class TestTruthExpectations < Test::Unit::TestCase
101
101
  def test_be_fail
102
102
  lambda {
103
103
  true.should be(false)
104
- }.should raise_error(Test::Unit::AssertionFailedError)
104
+ }.should raise_error(Matchy.assertion_failed_error)
105
105
  end
106
106
 
107
107
  def test_be_close
@@ -115,13 +115,13 @@ class TestTruthExpectations < Test::Unit::TestCase
115
115
  def test_be_close_fail
116
116
  lambda {
117
117
  (19.0 - 13.0).should be_close(33.04)
118
- }.should raise_error(Test::Unit::AssertionFailedError)
118
+ }.should raise_error(Matchy.assertion_failed_error)
119
119
  end
120
120
 
121
121
  def test_be_close_with_delta_fail
122
122
  lambda {
123
123
  (19.0 - 13.0).should be_close(6.0, 0.0)
124
- }.should raise_error(Test::Unit::AssertionFailedError)
124
+ }.should raise_error(Matchy.assertion_failed_error)
125
125
  end
126
126
 
127
127
  def test_satisfy
@@ -135,13 +135,13 @@ class TestTruthExpectations < Test::Unit::TestCase
135
135
  def test_satisfy_fail
136
136
  lambda {
137
137
  13.should satisfy(lambda {|i| i > 15})
138
- }.should raise_error(Test::Unit::AssertionFailedError)
138
+ }.should raise_error(Matchy.assertion_failed_error)
139
139
  end
140
140
 
141
141
  def test_negative_satisfy_fail
142
142
  lambda {
143
143
  13.should_not satisfy(lambda {|i| i < 15})
144
- }.should raise_error(Test::Unit::AssertionFailedError)
144
+ }.should raise_error(Matchy.assertion_failed_error)
145
145
  end
146
146
 
147
147
  def test_equal_fail_message
@@ -235,7 +235,7 @@ class TestTruthExpectations < Test::Unit::TestCase
235
235
  def test_kind_of_fail
236
236
  lambda {
237
237
  3.should be_kind_of(Hash)
238
- }.should raise_error(Test::Unit::AssertionFailedError)
238
+ }.should raise_error(Matchy.assertion_failed_error)
239
239
  end
240
240
 
241
241
  def test_negative_kind_of
@@ -245,7 +245,7 @@ class TestTruthExpectations < Test::Unit::TestCase
245
245
  def test_negative_kind_of_fail
246
246
  lambda {
247
247
  3.should_not be_kind_of(Fixnum)
248
- }.should raise_error(Test::Unit::AssertionFailedError)
248
+ }.should raise_error(Matchy.assertion_failed_error)
249
249
  end
250
250
 
251
251
  def test_respond_to
@@ -255,7 +255,7 @@ class TestTruthExpectations < Test::Unit::TestCase
255
255
  def test_respond_to_fail
256
256
  lambda {
257
257
  "foo".should respond_to(:nonexistant_method)
258
- }.should raise_error(Test::Unit::AssertionFailedError)
258
+ }.should raise_error(Matchy.assertion_failed_error)
259
259
  end
260
260
 
261
261
  def test_negative_respond_to
@@ -265,7 +265,7 @@ class TestTruthExpectations < Test::Unit::TestCase
265
265
  def test_negative_respond_to_fail
266
266
  lambda {
267
267
  "foo".should_not respond_to(:length)
268
- }.should raise_error(Test::Unit::AssertionFailedError)
268
+ }.should raise_error(Matchy.assertion_failed_error)
269
269
  end
270
270
 
271
271
  # be_something
@@ -280,7 +280,7 @@ class TestTruthExpectations < Test::Unit::TestCase
280
280
  def @obj.something?
281
281
  false
282
282
  end
283
- lambda {@obj.should be_something}.should raise_error(Test::Unit::AssertionFailedError)
283
+ lambda {@obj.should be_something}.should raise_error(Matchy.assertion_failed_error)
284
284
  end
285
285
 
286
286
  def test_negative_be_something_method_missing_pass
@@ -294,7 +294,7 @@ class TestTruthExpectations < Test::Unit::TestCase
294
294
  def @obj.something?
295
295
  true
296
296
  end
297
- lambda {@obj.should_not be_something}.should raise_error(Test::Unit::AssertionFailedError)
297
+ lambda {@obj.should_not be_something}.should raise_error(Matchy.assertion_failed_error)
298
298
  end
299
299
 
300
300
  def test_be_something_method_missing_fail_message
@@ -331,7 +331,7 @@ class TestTruthExpectations < Test::Unit::TestCase
331
331
  def @obj.something?(arg)
332
332
  false
333
333
  end
334
- lambda {@obj.should be_something(1)}.should raise_error(Test::Unit::AssertionFailedError)
334
+ lambda {@obj.should be_something(1)}.should raise_error(Matchy.assertion_failed_error)
335
335
  end
336
336
 
337
337
  def test_negative_be_something_method_missing_pass
@@ -345,7 +345,7 @@ class TestTruthExpectations < Test::Unit::TestCase
345
345
  def @obj.something?(arg)
346
346
  true
347
347
  end
348
- lambda {@obj.should_not be_something(1)}.should raise_error(Test::Unit::AssertionFailedError)
348
+ lambda {@obj.should_not be_something(1)}.should raise_error(Matchy.assertion_failed_error)
349
349
  end
350
350
 
351
351
  def test_be_something_method_missing_fail_message
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcmire-matchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy McAnally
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-08 00:00:00 -06:00
12
+ date: 2010-02-13 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -23,15 +23,9 @@ extensions: []
23
23
  extra_rdoc_files:
24
24
  - README.rdoc
25
25
  files:
26
- - .gitignore
27
- - History.txt
28
26
  - License.txt
29
- - Manifest.txt
30
- - PostInstall.txt
31
27
  - README.rdoc
32
28
  - Rakefile
33
- - config/hoe.rb
34
- - config/requirements.rb
35
29
  - countloc.rb
36
30
  - lib/matchy.rb
37
31
  - lib/matchy/built_in/change_expectations.rb
@@ -44,24 +38,8 @@ files:
44
38
  - lib/matchy/matcher_builder.rb
45
39
  - lib/matchy/modals.rb
46
40
  - lib/matchy/version.rb
47
- - mcmire-matchy.gemspec
48
- - setup.rb
49
- - tasks/deployment.rake
50
- - tasks/environment.rake
51
- - test/all.rb
52
- - test/ruby1.9.compatibility_tests.rb
53
- - test/test_change_expectation.rb
54
- - test/test_custom_matcher.rb
55
- - test/test_enumerable_expectations.rb
56
- - test/test_error_expectations.rb
57
- - test/test_expectation_builder.rb
58
- - test/test_helper.rb
59
- - test/test_matcher_builder.rb
60
- - test/test_modals.rb
61
- - test/test_operator_expectations.rb
62
- - test/test_truth_expectations.rb
63
41
  has_rdoc: true
64
- homepage: http://github.com/mcmire/matchy
42
+ homepage: http://matchy.rubyforge.org
65
43
  licenses: []
66
44
 
67
45
  post_install_message:
@@ -89,8 +67,6 @@ signing_key:
89
67
  specification_version: 3
90
68
  summary: RSpec-esque matchers for use in Test::Unit
91
69
  test_files:
92
- - test/all.rb
93
- - test/ruby1.9.compatibility_tests.rb
94
70
  - test/test_change_expectation.rb
95
71
  - test/test_custom_matcher.rb
96
72
  - test/test_enumerable_expectations.rb
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- pkg/*
2
- .DS_Store
3
- *.gem
@@ -1,4 +0,0 @@
1
- == 0.0.1 2008-10-03
2
-
3
- * 1 major enhancement:
4
- * Initial release
@@ -1,36 +0,0 @@
1
- History.txt
2
- License.txt
3
- Manifest.txt
4
- PostInstall.txt
5
- README.rdoc
6
- Rakefile
7
- config/hoe.rb
8
- config/requirements.rb
9
- countloc.rb
10
- lib/matchy.rb
11
- lib/matchy/built_in/change_expectations.rb
12
- lib/matchy/built_in/enumerable_expectations.rb
13
- lib/matchy/built_in/error_expectations.rb
14
- lib/matchy/built_in/operator_expectations.rb
15
- lib/matchy/built_in/truth_expectations.rb
16
- lib/matchy/custom_matcher.rb
17
- lib/matchy/expectation_builder.rb
18
- lib/matchy/matcher_builder.rb
19
- lib/matchy/modals.rb
20
- lib/matchy/version.rb
21
- matchy.gemspec
22
- setup.rb
23
- tasks/deployment.rake
24
- tasks/environment.rake
25
- test/all.rb
26
- test/ruby1.9.compatibility_tests.rb
27
- test/test_change_expectation.rb
28
- test/test_custom_matcher.rb
29
- test/test_enumerable_expectations.rb
30
- test/test_error_expectations.rb
31
- test/test_expectation_builder.rb
32
- test/test_helper.rb
33
- test/test_matcher_builder.rb
34
- test/test_modals.rb
35
- test/test_operator_expectations.rb
36
- test/test_truth_expectations.rb
@@ -1,7 +0,0 @@
1
-
2
- For more information on matchy, see http://matchy.rubyforge.org
3
-
4
- NOTE: Change this information in PostInstall.txt
5
- You can also delete it if you don't want it.
6
-
7
-
@@ -1,73 +0,0 @@
1
- require 'matchy/version'
2
-
3
- AUTHOR = 'Jeremy McAnally' # can also be an array of Authors
4
- EMAIL = "jeremy@entp.com"
5
- DESCRIPTION = "RSpec-esque matchers for use in Test::Unit"
6
- GEM_NAME = 'matchy' # what ppl will type to install your gem
7
- RUBYFORGE_PROJECT = 'matchy' # The unix name for your project
8
- HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
- DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
- EXTRA_DEPENDENCIES = [
11
- # ['activesupport', '>= 1.3.1']
12
- ] # An array of rubygem dependencies [name, version]
13
-
14
- @config_file = "~/.rubyforge/user-config.yml"
15
- @config = nil
16
- RUBYFORGE_USERNAME = "unknown"
17
- def rubyforge_username
18
- unless @config
19
- begin
20
- @config = YAML.load(File.read(File.expand_path(@config_file)))
21
- rescue
22
- puts <<-EOS
23
- ERROR: No rubyforge config file found: #{@config_file}
24
- Run 'rubyforge setup' to prepare your env for access to Rubyforge
25
- - See http://newgem.rubyforge.org/rubyforge.html for more details
26
- EOS
27
- exit
28
- end
29
- end
30
- RUBYFORGE_USERNAME.replace @config["username"]
31
- end
32
-
33
-
34
- REV = nil
35
- # UNCOMMENT IF REQUIRED:
36
- # REV = YAML.load(`svn info`)['Revision']
37
- VERS = Matchy::VERSION::STRING + (REV ? ".#{REV}" : "")
38
- RDOC_OPTS = ['--quiet', '--title', 'matchy documentation',
39
- "--opname", "index.html",
40
- "--line-numbers",
41
- "--main", "README.rdoc",
42
- "--inline-source"]
43
-
44
- class Hoe
45
- def extra_deps
46
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
47
- @extra_deps
48
- end
49
- end
50
-
51
- # Generate all the Rake tasks
52
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
53
- $hoe = Hoe.new(GEM_NAME, VERS) do |p|
54
- p.developer(AUTHOR, EMAIL)
55
- p.description = DESCRIPTION
56
- p.summary = DESCRIPTION
57
- p.url = HOMEPATH
58
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
59
- p.test_globs = ["test/**/test_*.rb"]
60
- p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
61
-
62
- # == Optional
63
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
64
- #p.extra_deps = EXTRA_DEPENDENCIES
65
-
66
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
67
- end
68
-
69
- CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
70
- PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
71
- $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
72
- $hoe.rsync_args = '-av --delete --ignore-errors'
73
- $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""