rspec-support 3.0.0.beta1 → 3.0.0.beta2
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.
- data.tar.gz.sig +0 -0
- data/Changelog.md +7 -1
- data/{License.txt → LICENSE.txt} +0 -0
- data/lib/rspec/support.rb +25 -0
- data/lib/rspec/support/fuzzy_matcher.rb +47 -0
- data/lib/rspec/support/spec.rb +43 -0
- data/lib/rspec/support/spec/deprecation_helpers.rb +19 -1
- data/lib/rspec/support/spec/in_sub_process.rb +2 -2
- data/lib/rspec/support/spec/with_isolated_stderr.rb +14 -0
- data/lib/rspec/support/version.rb +1 -1
- data/lib/rspec/support/version_checker.rb +53 -0
- data/lib/rspec/support/warnings.rb +1 -0
- metadata +63 -37
- metadata.gz.sig +0 -0
- checksums.yaml +0 -15
- checksums.yaml.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
+
### 3.0.0.beta2 / 2014-02-17
|
2
|
+
[full changelog](http://github.com/rspec/rspec-support/compare/v3.0.0.beta1...v3.0.0.beta2)
|
3
|
+
|
4
|
+
Bug Fixes:
|
5
|
+
|
6
|
+
* Issue message when :replacement is passed to `RSpec.warn_with`. (Jon Rowe)
|
7
|
+
|
1
8
|
### 3.0.0.beta1 / 2013-11-07
|
2
9
|
[full changelog](https://github.com/rspec/rspec-support/compare/0dc12d1bdbbacc757a9989f8c09cd08ef3a4837e...v3.0.0.beta1)
|
3
10
|
|
4
11
|
Initial release.
|
5
|
-
|
data/{License.txt → LICENSE.txt}
RENAMED
File without changes
|
data/lib/rspec/support.rb
CHANGED
@@ -2,5 +2,30 @@ require "rspec/support/version"
|
|
2
2
|
|
3
3
|
module RSpec
|
4
4
|
module Support
|
5
|
+
# @api private
|
6
|
+
KERNEL_METHOD_METHOD = ::Kernel.instance_method(:method)
|
7
|
+
|
8
|
+
# @api private
|
9
|
+
#
|
10
|
+
# Used internally to get a method handle for a particular object
|
11
|
+
# and method name.
|
12
|
+
#
|
13
|
+
# Includes handling for a few special cases:
|
14
|
+
#
|
15
|
+
# - Objects that redefine #method (e.g. an HTTPRequest struct)
|
16
|
+
# - BasicObject subclasses that mixin a Kernel dup (e.g. SimpleDelegator)
|
17
|
+
if RUBY_VERSION.to_i >= 2 && RUBY_ENGINE != 'rbx'
|
18
|
+
def self.method_handle_for(object, method_name)
|
19
|
+
KERNEL_METHOD_METHOD.bind(object).call(method_name)
|
20
|
+
end
|
21
|
+
else
|
22
|
+
def self.method_handle_for(object, method_name)
|
23
|
+
if ::Kernel === object
|
24
|
+
KERNEL_METHOD_METHOD.bind(object).call(method_name)
|
25
|
+
else
|
26
|
+
object.method(method_name)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
5
30
|
end
|
6
31
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module RSpec
|
2
|
+
module Support
|
3
|
+
# Provides a means to fuzzy-match between two arbitrary objects.
|
4
|
+
# Understands array/hash nesting. Uses `===` or `==` to
|
5
|
+
# perform the matching.
|
6
|
+
module FuzzyMatcher
|
7
|
+
# @api private
|
8
|
+
def self.values_match?(expected, actual)
|
9
|
+
if Array === expected && Enumerable === actual
|
10
|
+
return arrays_match?(expected, actual.to_a)
|
11
|
+
elsif Hash === expected && Hash === actual
|
12
|
+
return hashes_match?(expected, actual)
|
13
|
+
end
|
14
|
+
|
15
|
+
begin
|
16
|
+
actual == expected || expected === actual
|
17
|
+
rescue ArgumentError
|
18
|
+
# Some objects, like 0-arg lambdas on 1.9+, raise
|
19
|
+
# ArgumentError for `expected === actual`.
|
20
|
+
false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# @private
|
25
|
+
def self.arrays_match?(expected_list, actual_list)
|
26
|
+
return false if expected_list.size != actual_list.size
|
27
|
+
|
28
|
+
expected_list.zip(actual_list).all? do |expected, actual|
|
29
|
+
values_match?(expected, actual)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# @private
|
34
|
+
def self.hashes_match?(expected_hash, actual_hash)
|
35
|
+
return false if expected_hash.size != actual_hash.size
|
36
|
+
|
37
|
+
expected_hash.all? do |expected_key, expected_value|
|
38
|
+
actual_value = actual_hash.fetch(expected_key) { return false }
|
39
|
+
values_match?(expected_value, actual_value)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private_class_method :arrays_match?, :hashes_match?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
data/lib/rspec/support/spec.rb
CHANGED
@@ -1,14 +1,57 @@
|
|
1
1
|
require 'rspec/support/spec/deprecation_helpers'
|
2
|
+
require 'rspec/support/spec/with_isolated_stderr'
|
2
3
|
require 'rspec/support/spec/stderr_splitter'
|
3
4
|
|
4
5
|
warning_preventer = $stderr = RSpec::Support::StdErrSplitter.new($stderr)
|
5
6
|
|
6
7
|
RSpec.configure do |c|
|
7
8
|
c.include RSpecHelpers
|
9
|
+
c.include RSpec::Support::WithIsolatedStdErr
|
10
|
+
|
8
11
|
c.before do
|
9
12
|
warning_preventer.reset!
|
10
13
|
end
|
14
|
+
|
11
15
|
c.after do |example|
|
12
16
|
warning_preventer.verify_example!(example)
|
13
17
|
end
|
18
|
+
|
19
|
+
if c.files_to_run.one?
|
20
|
+
c.full_backtrace = true
|
21
|
+
c.formatter = 'doc' if c.formatters.none?
|
22
|
+
end
|
23
|
+
|
24
|
+
c.filter_run :focus
|
25
|
+
c.run_all_when_everything_filtered = true
|
26
|
+
end
|
27
|
+
|
28
|
+
module RSpec::Support::Spec
|
29
|
+
def self.setup_simplecov(&block)
|
30
|
+
# Simplecov emits some ruby warnings when loaded, so silence them.
|
31
|
+
old_verbose, $VERBOSE = $VERBOSE, false
|
32
|
+
|
33
|
+
return if ENV['NO_COVERAGE'] || RUBY_VERSION < '1.9.3' || RUBY_ENGINE != 'ruby'
|
34
|
+
|
35
|
+
# Don't load it when we're running a single isolated
|
36
|
+
# test file rather than the whole suite.
|
37
|
+
return if RSpec.configuration.files_to_run.one?
|
38
|
+
|
39
|
+
require 'simplecov'
|
40
|
+
|
41
|
+
SimpleCov.start do
|
42
|
+
add_filter "./bundle/"
|
43
|
+
add_filter "./tmp/"
|
44
|
+
add_filter do |source_file|
|
45
|
+
# Filter out `spec` directory except when it is under `lib`
|
46
|
+
# (as is the case in rspec-support)
|
47
|
+
source_file.filename.include?('/spec/') && !source_file.filename.include?('/lib/')
|
48
|
+
end
|
49
|
+
|
50
|
+
instance_eval(&block) if block
|
51
|
+
end
|
52
|
+
rescue LoadError
|
53
|
+
ensure
|
54
|
+
$VERBOSE = old_verbose
|
55
|
+
end
|
14
56
|
end
|
57
|
+
|
@@ -1,7 +1,21 @@
|
|
1
1
|
module RSpecHelpers
|
2
|
-
|
2
|
+
|
3
|
+
def expect_no_deprecation
|
4
|
+
expect(RSpec.configuration.reporter).not_to receive(:deprecation)
|
5
|
+
end
|
6
|
+
|
7
|
+
def expect_deprecation_with_call_site(file, line, snippet=//)
|
3
8
|
expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
|
4
9
|
expect(options[:call_site]).to include([file, line].join(':'))
|
10
|
+
expect(options[:deprecated]).to match(snippet)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def expect_warn_deprecation_with_call_site(file, line, snippet=//)
|
15
|
+
expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
|
16
|
+
message = options[:message]
|
17
|
+
expect(message).to match(snippet)
|
18
|
+
expect(message).to include([file, line].join(':'))
|
5
19
|
end
|
6
20
|
end
|
7
21
|
|
@@ -9,6 +23,10 @@ module RSpecHelpers
|
|
9
23
|
allow(RSpec.configuration.reporter).to receive(:deprecation)
|
10
24
|
end
|
11
25
|
|
26
|
+
def expect_no_deprecations
|
27
|
+
expect(RSpec.configuration.reporter).not_to receive(:deprecation)
|
28
|
+
end
|
29
|
+
|
12
30
|
def expect_warning_without_call_site(expected = //)
|
13
31
|
expect(::Kernel).to receive(:warn) do |message|
|
14
32
|
expect(message).to match expected
|
@@ -31,8 +31,8 @@ module RSpec
|
|
31
31
|
end
|
32
32
|
else
|
33
33
|
def in_sub_process
|
34
|
-
|
35
|
-
|
34
|
+
skip "This spec requires forking to work properly, " +
|
35
|
+
"and your platform does not support forking"
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module RSpec
|
2
|
+
module Support
|
3
|
+
LibraryVersionTooLowError = Class.new(StandardError)
|
4
|
+
|
5
|
+
# @private
|
6
|
+
class VersionChecker
|
7
|
+
def initialize(library_name, library_version, min_patch_level)
|
8
|
+
@library_name, @library_version = library_name, library_version
|
9
|
+
@min_patch_level = min_patch_level
|
10
|
+
|
11
|
+
@major, @minor, @patch = parse_version(library_version)
|
12
|
+
@min_major, @min_minor, @min_patch = parse_version(min_patch_level)
|
13
|
+
|
14
|
+
@comparison_result = compare_version
|
15
|
+
end
|
16
|
+
|
17
|
+
def check_version!
|
18
|
+
raise_too_low_error if too_low?
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def too_low?
|
24
|
+
@comparison_result == :too_low
|
25
|
+
end
|
26
|
+
|
27
|
+
def raise_too_low_error
|
28
|
+
raise LibraryVersionTooLowError,
|
29
|
+
"You are using #{@library_name} #{@library_version}. " +
|
30
|
+
"RSpec requires version #{version_requirement}."
|
31
|
+
end
|
32
|
+
|
33
|
+
def compare_version
|
34
|
+
case
|
35
|
+
when @major < @min_major then :too_low
|
36
|
+
when @major > @min_major then :ok
|
37
|
+
when @minor < @min_minor then :too_low
|
38
|
+
when @minor > @min_minor then :ok
|
39
|
+
when @patch < @min_patch then :too_low
|
40
|
+
else :ok
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def version_requirement
|
45
|
+
">= #{@min_patch_level}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def parse_version(version)
|
49
|
+
version.split('.').map { |v| v.to_i }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -34,6 +34,7 @@ module RSpec
|
|
34
34
|
# Used internally to print longer warnings
|
35
35
|
def self.warn_with(message, options = {})
|
36
36
|
call_site = options.fetch(:call_site) { CallerFilter.first_non_rspec_line }
|
37
|
+
message << " Use #{options[:replacement]} instead." if options[:replacement]
|
37
38
|
message << " Called from #{call_site}." if call_site
|
38
39
|
::Kernel.warn message
|
39
40
|
end
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.beta2
|
5
|
+
prerelease: 6
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- David Chelimsky
|
@@ -13,41 +14,57 @@ authors:
|
|
13
14
|
autorequire:
|
14
15
|
bindir: bin
|
15
16
|
cert_chain:
|
16
|
-
- !
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
17
|
+
- ! '-----BEGIN CERTIFICATE-----
|
18
|
+
|
19
|
+
MIIDjjCCAnagAwIBAgIBATANBgkqhkiG9w0BAQUFADBGMRIwEAYDVQQDDAlyc3Bl
|
20
|
+
|
21
|
+
Yy1kZXYxGzAZBgoJkiaJk/IsZAEZFgtnb29nbGVnb3VwczETMBEGCgmSJomT8ixk
|
22
|
+
|
23
|
+
ARkWA2NvbTAeFw0xMzExMDcxOTQyNTlaFw0xNDExMDcxOTQyNTlaMEYxEjAQBgNV
|
24
|
+
|
25
|
+
BAMM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ffT7eDrnbHnKweO1XdemRJC98u/yYxnGzMSWKEsn09etBlZ9
|
52
|
+
|
53
|
+
7H67k5Z3uf6cfLZgToWL6zShzZY3Nun5r73YsNf2/QZOe4UZe4vfGvn6baw53ys9
|
54
|
+
|
55
|
+
1yHC1AcSYpvi2dAbOiHT5iQF+krm4wse8KctXgTNnjMsHEoGKulJS2/sZl90jcCz
|
56
|
+
|
57
|
+
muA=
|
58
|
+
|
59
|
+
-----END CERTIFICATE-----
|
60
|
+
|
61
|
+
'
|
62
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
47
63
|
dependencies:
|
48
64
|
- !ruby/object:Gem::Dependency
|
49
65
|
name: bundler
|
50
66
|
requirement: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
51
68
|
requirements:
|
52
69
|
- - ~>
|
53
70
|
- !ruby/object:Gem::Version
|
@@ -55,6 +72,7 @@ dependencies:
|
|
55
72
|
type: :development
|
56
73
|
prerelease: false
|
57
74
|
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
58
76
|
requirements:
|
59
77
|
- - ~>
|
60
78
|
- !ruby/object:Gem::Version
|
@@ -62,6 +80,7 @@ dependencies:
|
|
62
80
|
- !ruby/object:Gem::Dependency
|
63
81
|
name: rake
|
64
82
|
requirement: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
65
84
|
requirements:
|
66
85
|
- - ~>
|
67
86
|
- !ruby/object:Gem::Version
|
@@ -69,6 +88,7 @@ dependencies:
|
|
69
88
|
type: :development
|
70
89
|
prerelease: false
|
71
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
72
92
|
requirements:
|
73
93
|
- - ~>
|
74
94
|
- !ruby/object:Gem::Version
|
@@ -76,6 +96,7 @@ dependencies:
|
|
76
96
|
- !ruby/object:Gem::Dependency
|
77
97
|
name: rspec
|
78
98
|
requirement: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
79
100
|
requirements:
|
80
101
|
- - ! '>='
|
81
102
|
- !ruby/object:Gem::Version
|
@@ -83,6 +104,7 @@ dependencies:
|
|
83
104
|
type: :development
|
84
105
|
prerelease: false
|
85
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
86
108
|
requirements:
|
87
109
|
- - ! '>='
|
88
110
|
- !ruby/object:Gem::Version
|
@@ -95,38 +117,42 @@ extra_rdoc_files: []
|
|
95
117
|
files:
|
96
118
|
- lib/rspec/support.rb
|
97
119
|
- lib/rspec/support/caller_filter.rb
|
120
|
+
- lib/rspec/support/fuzzy_matcher.rb
|
98
121
|
- lib/rspec/support/spec.rb
|
99
122
|
- lib/rspec/support/spec/deprecation_helpers.rb
|
100
123
|
- lib/rspec/support/spec/in_sub_process.rb
|
101
124
|
- lib/rspec/support/spec/stderr_splitter.rb
|
125
|
+
- lib/rspec/support/spec/with_isolated_stderr.rb
|
102
126
|
- lib/rspec/support/version.rb
|
127
|
+
- lib/rspec/support/version_checker.rb
|
103
128
|
- lib/rspec/support/warnings.rb
|
104
129
|
- README.md
|
105
|
-
-
|
130
|
+
- LICENSE.txt
|
106
131
|
- Changelog.md
|
107
132
|
homepage: https://github.com/rspec/rspec-support
|
108
133
|
licenses:
|
109
134
|
- MIT
|
110
|
-
metadata: {}
|
111
135
|
post_install_message:
|
112
136
|
rdoc_options:
|
113
137
|
- --charset=UTF-8
|
114
138
|
require_paths:
|
115
139
|
- lib
|
116
140
|
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
none: false
|
117
142
|
requirements:
|
118
143
|
- - ! '>='
|
119
144
|
- !ruby/object:Gem::Version
|
120
145
|
version: 1.8.7
|
121
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
+
none: false
|
122
148
|
requirements:
|
123
149
|
- - ! '>'
|
124
150
|
- !ruby/object:Gem::Version
|
125
151
|
version: 1.3.1
|
126
152
|
requirements: []
|
127
153
|
rubyforge_project: rspec
|
128
|
-
rubygems_version:
|
154
|
+
rubygems_version: 1.8.23
|
129
155
|
signing_key:
|
130
|
-
specification_version:
|
131
|
-
summary: rspec-support-3.0.0.
|
156
|
+
specification_version: 3
|
157
|
+
summary: rspec-support-3.0.0.beta2
|
132
158
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
NTY1ODMyNjMwYTQ5NmNiYTE2ZDE0Yzg4NmNjYjM3MTg1Y2M1OGMwOA==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZDUyM2RhMTFkYjYwZGMwZTQwNzhjYzM4ZDE4Y2Y3OTMwMjQxYzE0Zg==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
N2M3ZjE0Y2VhMGY4NWQ0YmM2ODk4NmNkNDQ3ZjI5M2M1MzQ5ZjZiMjE0NzA2
|
10
|
-
MGE5MzMxOWI1MTRjZDAwNzhiNDE1ZDBmYjMyZGY3NmNjMjZjZTBlZGY4ZWM2
|
11
|
-
OWVjMjM5NDQ0Y2EyMjM1YTZhNDA2NTAxYWUwZjk5NWU0ZDE4MmU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZTI5ZTRiNjFjYTQyNjY2ZTY4YzU5NDJiYzAwMDlkMWE1ZjYyN2E3NzMzYzVm
|
14
|
-
NzcwY2YxMTc3YTZlMDZhNzMxOGExMTg2Y2ViOWFmODg1ODBhMTk5ZGVkYTFk
|
15
|
-
OTRiMWUzMmUzNjJhMjU1M2E3Yzg3YjdhYzY0OGFjZWMzYzg2ZWQ=
|
checksums.yaml.gz.sig
DELETED
Binary file
|