minitest-matchers 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/History.txt +12 -0
  2. data/lib/minitest/matchers.rb +23 -19
  3. metadata +5 -5
@@ -1,3 +1,15 @@
1
+ === 1.0.2 / 2011-09-04
2
+
3
+ * 1 minor enhancement
4
+
5
+ * Fix typo
6
+
7
+ === 1.0.1 / 2011-09-04
8
+
9
+ * 1 minor enhancement
10
+
11
+ * Match first, then set failure message.
12
+
1
13
  === 1.0.0 / 2011-08-30
2
14
 
3
15
  * 1 major enhancement
@@ -1,20 +1,22 @@
1
1
  require "minitest/spec"
2
2
 
3
3
  module MiniTest::Matchers
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.2"
5
5
 
6
6
  def must &block
7
7
  matcher = yield
8
8
  check_matcher matcher
9
9
 
10
- failure_message = if matcher.respond_to? :failure_message
11
- matcher.failure_message
12
- else
13
- "expected to " + matcher.description
14
- end
15
-
16
10
  it "must #{matcher.description}" do
17
- assert matcher.matches?(subject), failure_message
11
+ result = matcher.matches? subject
12
+
13
+ failure_message = if matcher.respond_to? :failure_message
14
+ matcher.failure_message
15
+ else
16
+ "expected to " + matcher.description
17
+ end
18
+
19
+ assert result, failure_message
18
20
  end
19
21
 
20
22
  matcher
@@ -24,18 +26,20 @@ module MiniTest::Matchers
24
26
  matcher = yield
25
27
  check_matcher matcher
26
28
 
27
- failure_message = if matcher.respond_to? :negative_failure_message
28
- matcher.negative_failure_message
29
- else
30
- "expected not to " + matcher.description
31
- end
32
-
33
29
  it "wont #{matcher.description}" do
34
- if matcher.respond_to? :does_not_match
35
- assert matcher.does_not_match?(subject), failure_message
36
- else
37
- refute matcher.matches?(subject), failure_message
38
- end
30
+ result = if matcher.respond_to? :does_not_match?
31
+ result = matcher.does_not_match?(subject)
32
+ else
33
+ result = !matcher.matches?(subject)
34
+ end
35
+
36
+ failure_message = if matcher.respond_to? :negative_failure_message
37
+ matcher.negative_failure_message
38
+ else
39
+ "expected not to " + matcher.description
40
+ end
41
+
42
+ assert result, failure_message
39
43
  end
40
44
 
41
45
  matcher
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2011-09-04 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest
17
- requirement: &2152311960 !ruby/object:Gem::Requirement
17
+ requirement: &2152131540 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '1.6'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *2152311960
25
+ version_requirements: *2152131540
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: hoe
28
- requirement: &2152303800 !ruby/object:Gem::Requirement
28
+ requirement: &2152130120 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '2.12'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2152303800
36
+ version_requirements: *2152130120
37
37
  description: ! 'minitest-matchers adds support for RSpec/Shoulda-style matchers to
38
38
 
39
39
  MiniTest::Spec.