rspec-expectations 2.5.0 → 2.6.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -0
- data/Gemfile +13 -11
- data/README.md +2 -0
- data/Rakefile +28 -17
- data/features/Changelog.md +16 -0
- data/features/built_in_matchers/be.feature +4 -4
- data/features/built_in_matchers/be_within.feature +1 -1
- data/features/built_in_matchers/equality.feature +5 -5
- data/features/built_in_matchers/exist.feature +1 -1
- data/features/built_in_matchers/expect_change.feature +2 -2
- data/features/built_in_matchers/expect_error.feature +7 -7
- data/features/built_in_matchers/have.feature +2 -2
- data/features/built_in_matchers/include.feature +3 -3
- data/features/built_in_matchers/match.feature +2 -2
- data/features/built_in_matchers/operators.feature +3 -3
- data/features/built_in_matchers/predicates.feature +5 -5
- data/features/built_in_matchers/respond_to.feature +2 -2
- data/features/built_in_matchers/satisfy.feature +1 -1
- data/features/built_in_matchers/throw_symbol.feature +3 -3
- data/features/built_in_matchers/types.feature +2 -2
- data/features/custom_matchers/access_running_example.feature +2 -2
- data/features/custom_matchers/define_diffable_matcher.feature +1 -1
- data/features/custom_matchers/define_matcher.feature +40 -11
- data/features/custom_matchers/define_matcher_outside_rspec.feature +1 -1
- data/features/custom_matchers/define_matcher_with_fluent_interface.feature +1 -1
- data/features/customized_message.feature +1 -1
- data/features/diffing.feature +4 -4
- data/features/implicit_docstrings.feature +2 -2
- data/features/step_definitions/additional_cli_steps.rb +2 -2
- data/features/support/env.rb +5 -1
- data/features/test_frameworks/test_unit.feature +1 -1
- data/lib/rspec/expectations/backward_compatibility.rb +22 -1
- data/lib/rspec/expectations/version.rb +1 -1
- data/lib/rspec/matchers.rb +10 -5
- data/lib/rspec/matchers/change.rb +47 -32
- data/lib/rspec/matchers/has.rb +15 -11
- data/lib/rspec/matchers/matcher.rb +4 -0
- data/spec/rspec/matchers/be_spec.rb +0 -4
- data/spec/rspec/matchers/change_spec.rb +84 -9
- data/spec/rspec/matchers/description_generation_spec.rb +41 -25
- data/spec/rspec/matchers/has_spec.rb +2 -2
- data/spec/rspec/matchers/have_spec.rb +21 -21
- data/spec/rspec/matchers/matcher_spec.rb +46 -0
- data/spec/rspec/matchers/matchers_spec.rb +3 -23
- data/spec/rspec/matchers/method_missing_spec.rb +23 -0
- data/spec/spec_helper.rb +2 -0
- metadata +23 -18
- data/spec/suite.rb +0 -1
@@ -1,10 +1,56 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
class UnexpectedError < StandardError; end
|
4
|
+
module MatcherHelperModule
|
5
|
+
def self.included(base)
|
6
|
+
base.module_eval do
|
7
|
+
def included_method; end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.extended(base)
|
12
|
+
base.instance_eval do
|
13
|
+
def extended_method; end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def greeting
|
18
|
+
"Hello, World"
|
19
|
+
end
|
20
|
+
end
|
4
21
|
|
5
22
|
module RSpec
|
6
23
|
module Matchers
|
7
24
|
describe Matcher do
|
25
|
+
context "with an included module" do
|
26
|
+
let(:matcher) do
|
27
|
+
RSpec::Matchers::Matcher.new(:be_a_greeting) do
|
28
|
+
include MatcherHelperModule
|
29
|
+
match { |actual| actual == greeting }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it "has access to the module's methods" do
|
34
|
+
matcher.matches?("Hello, World")
|
35
|
+
end
|
36
|
+
|
37
|
+
it "runs the module's included hook" do
|
38
|
+
matcher.should respond_to(:included_method)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "does not run the module's extended hook" do
|
42
|
+
matcher.should_not respond_to(:extended_method)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'allows multiple modules to be included at once' do
|
46
|
+
m = RSpec::Matchers::Matcher.new(:multiple_modules) do
|
47
|
+
include Enumerable, Comparable
|
48
|
+
end
|
49
|
+
m.should be_a(Enumerable)
|
50
|
+
m.should be_a(Comparable)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
8
54
|
context "without overrides" do
|
9
55
|
before(:each) do
|
10
56
|
@matcher = RSpec::Matchers::Matcher.new(:be_a_multiple_of, 3) do |multiple|
|
@@ -1,19 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
module Test
|
4
|
-
module Unit
|
5
|
-
class TestCase
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
module MiniTest
|
11
|
-
module Unit
|
12
|
-
class TestCase
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
3
|
module RSpec
|
18
4
|
describe Matchers do
|
19
5
|
|
@@ -25,21 +11,15 @@ module RSpec
|
|
25
11
|
end
|
26
12
|
|
27
13
|
context "once required" do
|
28
|
-
|
29
|
-
before(:all) do
|
30
|
-
path = File.expand_path("../../../../#{path}", __FILE__)
|
31
|
-
load File.join(path, 'lib/rspec/matchers.rb')
|
32
|
-
end
|
33
|
-
|
34
14
|
it "includes itself in Test::Unit::TestCase" do
|
35
|
-
test_unit_case = Test::Unit::TestCase.
|
15
|
+
test_unit_case = Test::Unit::TestCase.allocate
|
36
16
|
sample_matchers.each do |sample_matcher|
|
37
17
|
test_unit_case.should respond_to(sample_matcher)
|
38
18
|
end
|
39
19
|
end
|
40
20
|
|
41
|
-
it "includes itself in MiniTest::Unit::TestCase" do
|
42
|
-
minitest_case = MiniTest::Unit::TestCase.
|
21
|
+
it "includes itself in MiniTest::Unit::TestCase", :if => defined?(MiniTest) do
|
22
|
+
minitest_case = MiniTest::Unit::TestCase.allocate
|
43
23
|
sample_matchers.each do |sample_matcher|
|
44
24
|
minitest_case.should respond_to(sample_matcher)
|
45
25
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
shared_examples_for "a well-behaved method_missing hook" do
|
4
|
+
it "raises a NoMethodError (and not SystemStackError) for an undefined method" do
|
5
|
+
expect { subject.some_undefined_method }.to raise_error(NoMethodError)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "RSpec::Matchers method_missing hook" do
|
10
|
+
subject { self }
|
11
|
+
it_behaves_like "a well-behaved method_missing hook"
|
12
|
+
|
13
|
+
context 'when invoked in a Test::Unit::TestCase' do
|
14
|
+
subject { Test::Unit::TestCase.allocate }
|
15
|
+
it_behaves_like "a well-behaved method_missing hook"
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when invoked in a MiniTest::Unit::TestCase', :if => defined?(MiniTest) do
|
19
|
+
subject { MiniTest::Unit::TestCase.allocate }
|
20
|
+
it_behaves_like "a well-behaved method_missing hook"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-expectations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15424049
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
8
|
+
- 6
|
9
9
|
- 0
|
10
|
-
|
10
|
+
- rc
|
11
|
+
- 2
|
12
|
+
version: 2.6.0.rc2
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- David Chelimsky
|
@@ -16,11 +18,14 @@ autorequire:
|
|
16
18
|
bindir: bin
|
17
19
|
cert_chain: []
|
18
20
|
|
19
|
-
date: 2011-
|
21
|
+
date: 2011-04-18 00:00:00 -05:00
|
20
22
|
default_executable:
|
21
23
|
dependencies:
|
22
24
|
- !ruby/object:Gem::Dependency
|
23
|
-
|
25
|
+
prerelease: false
|
26
|
+
type: :runtime
|
27
|
+
name: diff-lcs
|
28
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
29
|
none: false
|
25
30
|
requirements:
|
26
31
|
- - ~>
|
@@ -31,10 +36,7 @@ dependencies:
|
|
31
36
|
- 1
|
32
37
|
- 2
|
33
38
|
version: 1.1.2
|
34
|
-
|
35
|
-
name: diff-lcs
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: *id001
|
39
|
+
requirement: *id001
|
38
40
|
description: rspec expectations (should[_not] and matchers)
|
39
41
|
email: dchelimsky@gmail.com;chad.humphries@gmail.com
|
40
42
|
executables: []
|
@@ -46,6 +48,7 @@ extra_rdoc_files:
|
|
46
48
|
files:
|
47
49
|
- .document
|
48
50
|
- .gitignore
|
51
|
+
- .travis.yml
|
49
52
|
- Gemfile
|
50
53
|
- Guardfile
|
51
54
|
- License.txt
|
@@ -149,13 +152,13 @@ files:
|
|
149
152
|
- spec/rspec/matchers/match_spec.rb
|
150
153
|
- spec/rspec/matchers/matcher_spec.rb
|
151
154
|
- spec/rspec/matchers/matchers_spec.rb
|
155
|
+
- spec/rspec/matchers/method_missing_spec.rb
|
152
156
|
- spec/rspec/matchers/operator_matcher_spec.rb
|
153
157
|
- spec/rspec/matchers/raise_error_spec.rb
|
154
158
|
- spec/rspec/matchers/respond_to_spec.rb
|
155
159
|
- spec/rspec/matchers/satisfy_spec.rb
|
156
160
|
- spec/rspec/matchers/throw_symbol_spec.rb
|
157
161
|
- spec/spec_helper.rb
|
158
|
-
- spec/suite.rb
|
159
162
|
- spec/support/classes.rb
|
160
163
|
- spec/support/matchers.rb
|
161
164
|
- spec/support/ruby_version.rb
|
@@ -181,19 +184,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
185
|
none: false
|
183
186
|
requirements:
|
184
|
-
- - "
|
187
|
+
- - ">"
|
185
188
|
- !ruby/object:Gem::Version
|
186
|
-
hash:
|
189
|
+
hash: 25
|
187
190
|
segments:
|
188
|
-
-
|
189
|
-
|
191
|
+
- 1
|
192
|
+
- 3
|
193
|
+
- 1
|
194
|
+
version: 1.3.1
|
190
195
|
requirements: []
|
191
196
|
|
192
197
|
rubyforge_project: rspec
|
193
|
-
rubygems_version: 1.
|
198
|
+
rubygems_version: 1.5.2
|
194
199
|
signing_key:
|
195
200
|
specification_version: 3
|
196
|
-
summary: rspec-expectations-2.
|
201
|
+
summary: rspec-expectations-2.6.0.rc2
|
197
202
|
test_files:
|
198
203
|
- features/Changelog.md
|
199
204
|
- features/README.markdown
|
@@ -248,13 +253,13 @@ test_files:
|
|
248
253
|
- spec/rspec/matchers/match_spec.rb
|
249
254
|
- spec/rspec/matchers/matcher_spec.rb
|
250
255
|
- spec/rspec/matchers/matchers_spec.rb
|
256
|
+
- spec/rspec/matchers/method_missing_spec.rb
|
251
257
|
- spec/rspec/matchers/operator_matcher_spec.rb
|
252
258
|
- spec/rspec/matchers/raise_error_spec.rb
|
253
259
|
- spec/rspec/matchers/respond_to_spec.rb
|
254
260
|
- spec/rspec/matchers/satisfy_spec.rb
|
255
261
|
- spec/rspec/matchers/throw_symbol_spec.rb
|
256
262
|
- spec/spec_helper.rb
|
257
|
-
- spec/suite.rb
|
258
263
|
- spec/support/classes.rb
|
259
264
|
- spec/support/matchers.rb
|
260
265
|
- spec/support/ruby_version.rb
|
data/spec/suite.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Dir["spec/**/*_spec.rb"].each {|f| require f}
|