minitest-matchers 1.1.1 → 1.1.2

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.
Files changed (4) hide show
  1. data/History.txt +7 -0
  2. data/README.txt +9 -0
  3. data/lib/minitest/matchers.rb +31 -11
  4. metadata +8 -8
@@ -1,3 +1,10 @@
1
+ === 1.1.2 / 2011-11-22
2
+
3
+ * 2 minor enhancement
4
+
5
+ * Restore class level must and wont
6
+ * Don't check for implicit subject. It's implicit
7
+
1
8
  === 1.1.1 / 2011-11-18
2
9
 
3
10
  * 1 minor enhancement
data/README.txt CHANGED
@@ -71,6 +71,15 @@ For use with Rails check out (ValidAttribute + Capybara):
71
71
  it { wont have_valid(:title).when("", nil, "Bad") }
72
72
  end
73
73
 
74
+ # or
75
+
76
+ describe Post do
77
+ subject { Post.new }
78
+
79
+ must { have_valid(:title).when("Hello") }
80
+ wont { have_valid(:title).when("", nil, "Bad") }
81
+ end
82
+
74
83
  == REQUIREMENTS:
75
84
 
76
85
  * minitest >= 2.7.0
@@ -1,7 +1,7 @@
1
1
  require "minitest/spec"
2
2
 
3
3
  module MiniTest::Matchers
4
- VERSION = "1.1.1" # :nodoc:
4
+ VERSION = "1.1.2" # :nodoc:
5
5
  end
6
6
 
7
7
  module MiniTest
@@ -77,6 +77,34 @@ module MiniTest
77
77
  end
78
78
 
79
79
  class MiniTest::Spec
80
+ ##
81
+ # Expects that matcher matches the subject
82
+ #
83
+ # Example:
84
+ #
85
+ # describe Post do
86
+ # subject { Post.new }
87
+ #
88
+ # must { have_valid(:title).when("Good") }
89
+ # end
90
+ def self.must(&block)
91
+ it { subject.must instance_eval(&block) }
92
+ end
93
+
94
+ ##
95
+ # Expects that matcher does not match the subject
96
+ #
97
+ # Example:
98
+ #
99
+ # describe Post do
100
+ # subject { Post.new }
101
+ #
102
+ # wont { have_valid(:title).when("Bad") }
103
+ # end
104
+ def self.wont(&block)
105
+ it { subject.wont instance_eval(&block) }
106
+ end
107
+
80
108
  ##
81
109
  # Define a `must` expectation for implicit subject
82
110
  #
@@ -89,11 +117,7 @@ class MiniTest::Spec
89
117
  # end
90
118
 
91
119
  def must(*args, &block)
92
- if respond_to?(:subject)
93
- subject.must(*args, &block)
94
- else
95
- super
96
- end
120
+ subject.must(*args, &block)
97
121
  end
98
122
 
99
123
  ##
@@ -108,11 +132,7 @@ class MiniTest::Spec
108
132
  # end
109
133
 
110
134
  def wont(*args, &block)
111
- if respond_to?(:subject)
112
- subject.wont(*args, &block)
113
- else
114
- super
115
- end
135
+ subject.wont(*args, &block)
116
136
  end
117
137
  end
118
138
 
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.1.1
4
+ version: 1.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-11-18 00:00:00.000000000 Z
13
+ date: 2011-11-22 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest
17
- requirement: &70120472096340 !ruby/object:Gem::Requirement
17
+ requirement: &70356627130540 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 2.5.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70120472096340
25
+ version_requirements: *70356627130540
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: minitest
28
- requirement: &70120472095800 !ruby/object:Gem::Requirement
28
+ requirement: &70356627130080 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '2.8'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70120472095800
36
+ version_requirements: *70356627130080
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: hoe
39
- requirement: &70120472095240 !ruby/object:Gem::Requirement
39
+ requirement: &70356627129540 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '2.12'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *70120472095240
47
+ version_requirements: *70356627129540
48
48
  description: ! 'minitest-matchers adds support for RSpec/Shoulda-style matchers to
49
49
 
50
50
  minitest/unit and minitest/spec.