rspec-expectations 2.99.2 → 3.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +14 -6
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -0
- data/Changelog.md +63 -104
- data/License.txt +1 -0
- data/README.md +14 -8
- data/features/README.md +1 -2
- data/features/built_in_matchers/README.md +3 -0
- data/features/built_in_matchers/be.feature +44 -44
- data/features/built_in_matchers/be_within.feature +1 -1
- data/features/built_in_matchers/comparisons.feature +97 -0
- data/features/built_in_matchers/cover.feature +3 -3
- data/features/built_in_matchers/end_with.feature +3 -3
- data/features/built_in_matchers/equality.feature +20 -23
- data/features/built_in_matchers/exist.feature +5 -5
- data/features/built_in_matchers/expect_error.feature +14 -14
- data/features/built_in_matchers/include.feature +15 -15
- data/features/built_in_matchers/match.feature +4 -5
- data/features/built_in_matchers/match_array.feature +37 -0
- data/features/built_in_matchers/predicates.feature +30 -6
- data/features/built_in_matchers/respond_to.feature +4 -4
- data/features/built_in_matchers/satisfy.feature +2 -2
- data/features/built_in_matchers/start_with.feature +3 -3
- data/features/built_in_matchers/types.feature +6 -6
- data/features/custom_matchers/access_running_example.feature +3 -3
- data/features/custom_matchers/define_matcher.feature +6 -34
- data/features/custom_matchers/define_matcher_outside_rspec.feature +2 -2
- data/features/custom_matchers/define_matcher_with_fluent_interface.feature +1 -1
- data/features/customized_message.feature +18 -1
- data/features/diffing.feature +3 -3
- data/features/implicit_docstrings.feature +9 -9
- data/features/step_definitions/additional_cli_steps.rb +0 -10
- data/features/support/env.rb +10 -3
- data/features/test_frameworks/test_unit.feature +0 -40
- data/lib/rspec-expectations.rb +0 -5
- data/lib/rspec/expectations.rb +4 -18
- data/lib/rspec/expectations/expectation_target.rb +10 -77
- data/lib/rspec/expectations/extensions.rb +0 -1
- data/lib/rspec/expectations/handler.rb +1 -5
- data/lib/rspec/expectations/syntax.rb +25 -5
- data/lib/rspec/expectations/version.rb +1 -1
- data/lib/rspec/matchers.rb +7 -102
- data/lib/rspec/matchers/built_in/base_matcher.rb +10 -17
- data/lib/rspec/matchers/built_in/be.rb +5 -18
- data/lib/rspec/matchers/built_in/be_within.rb +2 -8
- data/lib/rspec/matchers/built_in/change.rb +1 -39
- data/lib/rspec/matchers/built_in/has.rb +7 -40
- data/lib/rspec/matchers/built_in/include.rb +1 -1
- data/lib/rspec/matchers/built_in/match_array.rb +1 -1
- data/lib/rspec/matchers/built_in/raise_error.rb +44 -23
- data/lib/rspec/matchers/built_in/respond_to.rb +1 -7
- data/lib/rspec/matchers/built_in/satisfy.rb +1 -7
- data/lib/rspec/matchers/built_in/throw_symbol.rb +2 -10
- data/lib/rspec/matchers/built_in/yield.rb +4 -25
- data/lib/rspec/matchers/compatibility.rb +2 -2
- data/lib/rspec/{expectations → matchers}/configuration.rb +9 -6
- data/lib/rspec/matchers/dsl.rb +2 -4
- data/lib/rspec/matchers/matcher.rb +163 -283
- data/lib/rspec/matchers/operator_matcher.rb +57 -71
- data/lib/rspec/matchers/pretty.rb +0 -4
- data/lib/rspec/matchers/test_unit_integration.rb +5 -22
- data/spec/rspec/expectations/expectation_target_spec.rb +0 -62
- data/spec/rspec/expectations/extensions/kernel_spec.rb +0 -4
- data/spec/rspec/expectations_spec.rb +2 -43
- data/spec/rspec/matchers/base_matcher_spec.rb +12 -27
- data/spec/rspec/matchers/be_spec.rb +2 -71
- data/spec/rspec/matchers/change_spec.rb +1 -76
- data/spec/rspec/{expectations → matchers}/configuration_spec.rb +41 -21
- data/spec/rspec/matchers/description_generation_spec.rb +2 -21
- data/spec/rspec/matchers/equal_spec.rb +0 -26
- data/spec/rspec/matchers/has_spec.rb +0 -24
- data/spec/rspec/matchers/match_array_spec.rb +0 -13
- data/spec/rspec/matchers/matcher_spec.rb +325 -279
- data/spec/rspec/matchers/matchers_spec.rb +36 -0
- data/spec/rspec/matchers/operator_matcher_spec.rb +8 -27
- data/spec/rspec/matchers/raise_error_spec.rb +65 -209
- data/spec/rspec/matchers/yield_spec.rb +32 -9
- data/spec/spec_helper.rb +21 -6
- data/spec/support/classes.rb +7 -7
- data/spec/support/in_sub_process.rb +7 -8
- data/spec/support/shared_examples.rb +0 -42
- metadata +113 -84
- metadata.gz.sig +4 -0
- data/features/built_in_matchers/have.feature +0 -109
- data/features/built_in_matchers/operators.feature +0 -227
- data/lib/rspec/expectations/caller_filter.rb +0 -60
- data/lib/rspec/expectations/deprecation.rb +0 -27
- data/lib/rspec/expectations/extensions/array.rb +0 -9
- data/lib/rspec/matchers/be_close.rb +0 -12
- data/lib/rspec/matchers/built_in/have.rb +0 -273
- data/lib/rspec/matchers/differentiate_block_method_types.rb +0 -55
- data/lib/rspec/matchers/extensions/instance_eval_with_args.rb +0 -39
- data/lib/rspec/matchers/match_aliases.rb +0 -22
- data/spec/rspec/matchers/be_close_spec.rb +0 -25
- data/spec/rspec/matchers/differentiate_block_method_types_spec.rb +0 -39
- data/spec/rspec/matchers/have_spec.rb +0 -853
- data/spec/rspec/matchers/pretty_spec.rb +0 -23
- data/spec/support/helper_methods.rb +0 -42
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module RSpec
|
4
|
-
module Matchers
|
5
|
-
describe Pretty do
|
6
|
-
include Pretty
|
7
|
-
|
8
|
-
describe "#_pretty_print" do
|
9
|
-
it 'is deprecated' do
|
10
|
-
expect_deprecation_with_call_site(__FILE__, __LINE__ + 1, /_pretty_print/)
|
11
|
-
_pretty_print([1, 2])
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "#expected_to_sentence" do
|
16
|
-
it 'is deprecated' do
|
17
|
-
expect_deprecation_with_call_site(__FILE__, __LINE__ + 1, /expected_to_sentence/)
|
18
|
-
expected_to_sentence
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module DeprecationHelpers
|
2
|
-
|
3
|
-
def expect_deprecation_with_call_site(file, line, snippet = //)
|
4
|
-
expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
|
5
|
-
matcher = include([file, line].join(':'))
|
6
|
-
call_site = options[:call_site] || options[:message]
|
7
|
-
|
8
|
-
unless matcher.matches?(call_site)
|
9
|
-
# RSpec::Expectations::ExpectationNotMetError is rescued in the `match` block
|
10
|
-
# of a custom matcher and returned as `false` from `matches?`. This would
|
11
|
-
# prevent an expectation failure here from surfacing in the test suite if
|
12
|
-
# it's triggered from within a `match` block, so we need to raise
|
13
|
-
# a different error class instead.
|
14
|
-
raise matcher.failure_message_for_should
|
15
|
-
end
|
16
|
-
|
17
|
-
deprecated = options[:deprecated] || options[:message]
|
18
|
-
expect(deprecated).to match(snippet)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def expect_deprecation_with_type(expression, message, type)
|
23
|
-
expect(RSpec).to receive(:deprecate).with(expression,
|
24
|
-
:replacement => message,
|
25
|
-
:type => type
|
26
|
-
)
|
27
|
-
end
|
28
|
-
|
29
|
-
def expect_deprecation_with_replacement(snippet)
|
30
|
-
expect(RSpec).to receive(:deprecate) do |_, options|
|
31
|
-
expect(options[:replacement]).to match(snippet)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def allow_deprecation
|
36
|
-
allow(RSpec.configuration.reporter).to receive(:deprecation)
|
37
|
-
end
|
38
|
-
|
39
|
-
def expect_no_deprecation
|
40
|
-
expect(RSpec.configuration.reporter).not_to receive(:deprecation)
|
41
|
-
end
|
42
|
-
end
|