rspec_multi_matchers 1.0.4 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -1
- data/Rakefile +2 -1
- data/lib/match_each.rb +5 -6
- data/lib/rspec_multi_matchers.rb +1 -1
- data/script/console +0 -0
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/spec/shared_enum_spec.rb +2 -1
- metadata +27 -20
data/README.rdoc
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
= rspec-multi-matchers
|
2
2
|
|
3
|
+
== Summary
|
4
|
+
* test collection using each or other enumerable methods
|
5
|
+
* tests fell more natural and have a friendlier failure message
|
6
|
+
|
7
|
+
== HomePage
|
3
8
|
* http://github.com/gregwebs/rspec-multi-matchers
|
4
9
|
|
5
10
|
== DESCRIPTION:
|
@@ -44,7 +49,7 @@ this is necessary because 'do .. end' does not bind strong enough
|
|
44
49
|
|
45
50
|
== INSTALL:
|
46
51
|
|
47
|
-
*
|
52
|
+
* gem install rspec_multi_matchers
|
48
53
|
|
49
54
|
== LICENSE:
|
50
55
|
|
data/Rakefile
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
|
1
|
+
%w[rubygems rake rake/clean fileutils newgem rubigen hoe].each { |f| require f }
|
2
2
|
require File.dirname(__FILE__) + '/lib/rspec_multi_matchers'
|
3
3
|
|
4
4
|
# Generate all the Rake tasks
|
5
5
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
6
6
|
$hoe = Hoe.new('rspec_multi_matchers', RspecMultiMatchers::VERSION) do |p|
|
7
7
|
p.developer('Greg Weber', '')
|
8
|
+
p.summary = "better collection testing"
|
8
9
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
10
|
# p.extra_deps = [
|
10
11
|
# ['activesupport','>= 2.0.2'],
|
data/lib/match_each.rb
CHANGED
@@ -7,9 +7,8 @@ class MatchEach
|
|
7
7
|
|
8
8
|
def initialize(options, &block)
|
9
9
|
@empty_okay = (options and options[:empty])
|
10
|
-
@block = block
|
11
|
-
|
12
|
-
raise NoBlockGivenError, 'no block given, you probably need to use brackets instead of "do...end"'
|
10
|
+
unless @block = block
|
11
|
+
raise NoBlockGivenError, 'No block given. You probably need to use brackets "{...}" instead of "do...end"'
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
@@ -23,9 +22,9 @@ class MatchEach
|
|
23
22
|
end
|
24
23
|
|
25
24
|
@counter = 0
|
26
|
-
target.
|
25
|
+
target.each do |obj|
|
27
26
|
begin
|
28
|
-
@block.call(obj
|
27
|
+
@block.call(obj)
|
29
28
|
rescue Spec::Expectations::ExpectationNotMetError => e
|
30
29
|
@error = e
|
31
30
|
@failure_object = obj
|
@@ -56,7 +55,7 @@ class MatchEach
|
|
56
55
|
if line.match(/:\d+:in\s*[`'"](.*)[`'"]\s*$/)
|
57
56
|
return error_line if $1 == 'matches?'
|
58
57
|
else
|
59
|
-
error_line = line.match(
|
58
|
+
error_line = line.match(/^[^:]+:(\d+)/)[1]
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
data/lib/rspec_multi_matchers.rb
CHANGED
data/script/console
CHANGED
File without changes
|
data/script/destroy
CHANGED
File without changes
|
data/script/generate
CHANGED
File without changes
|
data/spec/shared_enum_spec.rb
CHANGED
@@ -7,7 +7,8 @@ shared_examples_for "each matcher" do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'should not raise an error for met expectations' do
|
10
|
-
|
10
|
+
i = 0
|
11
|
+
[1,2,3].should send(*@iterator) {|n| n.should == (i+=1)}
|
11
12
|
end
|
12
13
|
|
13
14
|
it 'should raise an error if there are no items in the enumerable object' do
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_multi_matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 27
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 6
|
9
|
+
version: 1.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Greg Weber
|
@@ -14,38 +14,42 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2010-07-08 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: newgem
|
22
|
-
prerelease: false
|
23
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
24
|
- - ">="
|
26
25
|
- !ruby/object:Gem::Version
|
26
|
+
hash: 7
|
27
27
|
segments:
|
28
28
|
- 1
|
29
|
-
-
|
30
|
-
-
|
31
|
-
version: 1.
|
29
|
+
- 5
|
30
|
+
- 2
|
31
|
+
version: 1.5.2
|
32
|
+
version:
|
32
33
|
type: :development
|
34
|
+
version_requirement:
|
33
35
|
version_requirements: *id001
|
34
36
|
- !ruby/object:Gem::Dependency
|
35
37
|
name: hoe
|
36
|
-
prerelease: false
|
37
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
39
|
requirements:
|
39
40
|
- - ">="
|
40
41
|
- !ruby/object:Gem::Version
|
42
|
+
hash: 5
|
41
43
|
segments:
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
45
|
-
version:
|
44
|
+
- 2
|
45
|
+
- 3
|
46
|
+
- 3
|
47
|
+
version: 2.3.3
|
48
|
+
version:
|
46
49
|
type: :development
|
50
|
+
version_requirement:
|
47
51
|
version_requirements: *id002
|
48
|
-
description: "
|
52
|
+
description: ""
|
49
53
|
email:
|
50
54
|
- ""
|
51
55
|
executables: []
|
@@ -55,7 +59,6 @@ extensions: []
|
|
55
59
|
extra_rdoc_files:
|
56
60
|
- History.txt
|
57
61
|
- Manifest.txt
|
58
|
-
- README.rdoc
|
59
62
|
files:
|
60
63
|
- History.txt
|
61
64
|
- Manifest.txt
|
@@ -76,35 +79,39 @@ files:
|
|
76
79
|
- spec/spec_helper.rb
|
77
80
|
- tasks/rspec.rake
|
78
81
|
has_rdoc: true
|
79
|
-
homepage:
|
82
|
+
homepage:
|
80
83
|
licenses: []
|
81
84
|
|
82
85
|
post_install_message:
|
83
86
|
rdoc_options:
|
84
87
|
- --main
|
85
|
-
- README.
|
88
|
+
- README.txt
|
86
89
|
require_paths:
|
87
90
|
- lib
|
88
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
89
92
|
requirements:
|
90
93
|
- - ">="
|
91
94
|
- !ruby/object:Gem::Version
|
95
|
+
hash: 3
|
92
96
|
segments:
|
93
97
|
- 0
|
94
98
|
version: "0"
|
99
|
+
version:
|
95
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
101
|
requirements:
|
97
102
|
- - ">="
|
98
103
|
- !ruby/object:Gem::Version
|
104
|
+
hash: 3
|
99
105
|
segments:
|
100
106
|
- 0
|
101
107
|
version: "0"
|
108
|
+
version:
|
102
109
|
requirements: []
|
103
110
|
|
104
111
|
rubyforge_project: rspec_multi_matchers
|
105
|
-
rubygems_version: 1.3.
|
112
|
+
rubygems_version: 1.3.7
|
106
113
|
signing_key:
|
107
|
-
specification_version:
|
108
|
-
summary:
|
114
|
+
specification_version: 3
|
115
|
+
summary: better collection testing
|
109
116
|
test_files: []
|
110
117
|
|