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.
Files changed (98) hide show
  1. checksums.yaml +14 -6
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +2 -0
  4. data/Changelog.md +63 -104
  5. data/License.txt +1 -0
  6. data/README.md +14 -8
  7. data/features/README.md +1 -2
  8. data/features/built_in_matchers/README.md +3 -0
  9. data/features/built_in_matchers/be.feature +44 -44
  10. data/features/built_in_matchers/be_within.feature +1 -1
  11. data/features/built_in_matchers/comparisons.feature +97 -0
  12. data/features/built_in_matchers/cover.feature +3 -3
  13. data/features/built_in_matchers/end_with.feature +3 -3
  14. data/features/built_in_matchers/equality.feature +20 -23
  15. data/features/built_in_matchers/exist.feature +5 -5
  16. data/features/built_in_matchers/expect_error.feature +14 -14
  17. data/features/built_in_matchers/include.feature +15 -15
  18. data/features/built_in_matchers/match.feature +4 -5
  19. data/features/built_in_matchers/match_array.feature +37 -0
  20. data/features/built_in_matchers/predicates.feature +30 -6
  21. data/features/built_in_matchers/respond_to.feature +4 -4
  22. data/features/built_in_matchers/satisfy.feature +2 -2
  23. data/features/built_in_matchers/start_with.feature +3 -3
  24. data/features/built_in_matchers/types.feature +6 -6
  25. data/features/custom_matchers/access_running_example.feature +3 -3
  26. data/features/custom_matchers/define_matcher.feature +6 -34
  27. data/features/custom_matchers/define_matcher_outside_rspec.feature +2 -2
  28. data/features/custom_matchers/define_matcher_with_fluent_interface.feature +1 -1
  29. data/features/customized_message.feature +18 -1
  30. data/features/diffing.feature +3 -3
  31. data/features/implicit_docstrings.feature +9 -9
  32. data/features/step_definitions/additional_cli_steps.rb +0 -10
  33. data/features/support/env.rb +10 -3
  34. data/features/test_frameworks/test_unit.feature +0 -40
  35. data/lib/rspec-expectations.rb +0 -5
  36. data/lib/rspec/expectations.rb +4 -18
  37. data/lib/rspec/expectations/expectation_target.rb +10 -77
  38. data/lib/rspec/expectations/extensions.rb +0 -1
  39. data/lib/rspec/expectations/handler.rb +1 -5
  40. data/lib/rspec/expectations/syntax.rb +25 -5
  41. data/lib/rspec/expectations/version.rb +1 -1
  42. data/lib/rspec/matchers.rb +7 -102
  43. data/lib/rspec/matchers/built_in/base_matcher.rb +10 -17
  44. data/lib/rspec/matchers/built_in/be.rb +5 -18
  45. data/lib/rspec/matchers/built_in/be_within.rb +2 -8
  46. data/lib/rspec/matchers/built_in/change.rb +1 -39
  47. data/lib/rspec/matchers/built_in/has.rb +7 -40
  48. data/lib/rspec/matchers/built_in/include.rb +1 -1
  49. data/lib/rspec/matchers/built_in/match_array.rb +1 -1
  50. data/lib/rspec/matchers/built_in/raise_error.rb +44 -23
  51. data/lib/rspec/matchers/built_in/respond_to.rb +1 -7
  52. data/lib/rspec/matchers/built_in/satisfy.rb +1 -7
  53. data/lib/rspec/matchers/built_in/throw_symbol.rb +2 -10
  54. data/lib/rspec/matchers/built_in/yield.rb +4 -25
  55. data/lib/rspec/matchers/compatibility.rb +2 -2
  56. data/lib/rspec/{expectations → matchers}/configuration.rb +9 -6
  57. data/lib/rspec/matchers/dsl.rb +2 -4
  58. data/lib/rspec/matchers/matcher.rb +163 -283
  59. data/lib/rspec/matchers/operator_matcher.rb +57 -71
  60. data/lib/rspec/matchers/pretty.rb +0 -4
  61. data/lib/rspec/matchers/test_unit_integration.rb +5 -22
  62. data/spec/rspec/expectations/expectation_target_spec.rb +0 -62
  63. data/spec/rspec/expectations/extensions/kernel_spec.rb +0 -4
  64. data/spec/rspec/expectations_spec.rb +2 -43
  65. data/spec/rspec/matchers/base_matcher_spec.rb +12 -27
  66. data/spec/rspec/matchers/be_spec.rb +2 -71
  67. data/spec/rspec/matchers/change_spec.rb +1 -76
  68. data/spec/rspec/{expectations → matchers}/configuration_spec.rb +41 -21
  69. data/spec/rspec/matchers/description_generation_spec.rb +2 -21
  70. data/spec/rspec/matchers/equal_spec.rb +0 -26
  71. data/spec/rspec/matchers/has_spec.rb +0 -24
  72. data/spec/rspec/matchers/match_array_spec.rb +0 -13
  73. data/spec/rspec/matchers/matcher_spec.rb +325 -279
  74. data/spec/rspec/matchers/matchers_spec.rb +36 -0
  75. data/spec/rspec/matchers/operator_matcher_spec.rb +8 -27
  76. data/spec/rspec/matchers/raise_error_spec.rb +65 -209
  77. data/spec/rspec/matchers/yield_spec.rb +32 -9
  78. data/spec/spec_helper.rb +21 -6
  79. data/spec/support/classes.rb +7 -7
  80. data/spec/support/in_sub_process.rb +7 -8
  81. data/spec/support/shared_examples.rb +0 -42
  82. metadata +113 -84
  83. metadata.gz.sig +4 -0
  84. data/features/built_in_matchers/have.feature +0 -109
  85. data/features/built_in_matchers/operators.feature +0 -227
  86. data/lib/rspec/expectations/caller_filter.rb +0 -60
  87. data/lib/rspec/expectations/deprecation.rb +0 -27
  88. data/lib/rspec/expectations/extensions/array.rb +0 -9
  89. data/lib/rspec/matchers/be_close.rb +0 -12
  90. data/lib/rspec/matchers/built_in/have.rb +0 -273
  91. data/lib/rspec/matchers/differentiate_block_method_types.rb +0 -55
  92. data/lib/rspec/matchers/extensions/instance_eval_with_args.rb +0 -39
  93. data/lib/rspec/matchers/match_aliases.rb +0 -22
  94. data/spec/rspec/matchers/be_close_spec.rb +0 -25
  95. data/spec/rspec/matchers/differentiate_block_method_types_spec.rb +0 -39
  96. data/spec/rspec/matchers/have_spec.rb +0 -853
  97. data/spec/rspec/matchers/pretty_spec.rb +0 -23
  98. data/spec/support/helper_methods.rb +0 -42
@@ -1,95 +1,81 @@
1
1
  module RSpec
2
2
  module Matchers
3
- module BuiltIn
4
- class OperatorMatcher
5
- class << self
6
- def registry
7
- @registry ||= {}
8
- end
3
+ class OperatorMatcher
4
+ class << self
5
+ def registry
6
+ @registry ||= {}
7
+ end
9
8
 
10
- def register(klass, operator, matcher)
11
- registry[klass] ||= {}
12
- registry[klass][operator] = matcher
13
- end
9
+ def register(klass, operator, matcher)
10
+ registry[klass] ||= {}
11
+ registry[klass][operator] = matcher
12
+ end
14
13
 
15
- def unregister(klass, operator)
16
- registry[klass] && registry[klass].delete(operator)
17
- end
14
+ def unregister(klass, operator)
15
+ registry[klass] && registry[klass].delete(operator)
16
+ end
18
17
 
19
- def get(klass, operator)
20
- klass.ancestors.each { |ancestor|
21
- matcher = registry[ancestor] && registry[ancestor][operator]
22
- return matcher if matcher
23
- }
18
+ def get(klass, operator)
19
+ klass.ancestors.each { |ancestor|
20
+ matcher = registry[ancestor] && registry[ancestor][operator]
21
+ return matcher if matcher
22
+ }
24
23
 
25
- nil
26
- end
24
+ nil
27
25
  end
26
+ end
28
27
 
29
- def initialize(actual)
30
- @actual = actual
31
- end
28
+ def initialize(actual)
29
+ @actual = actual
30
+ end
32
31
 
33
- def self.use_custom_matcher_or_delegate(operator)
34
- define_method(operator) do |expected|
35
- if !has_non_generic_implementation_of?(operator) && matcher = OperatorMatcher.get(@actual.class, operator)
36
- @actual.__send__(::RSpec::Matchers.last_should, matcher.new(expected))
37
- else
38
- eval_match(@actual, operator, expected)
39
- end
32
+ def self.use_custom_matcher_or_delegate(operator)
33
+ define_method(operator) do |expected|
34
+ if uses_generic_implementation_of?(operator) && matcher = OperatorMatcher.get(@actual.class, operator)
35
+ @actual.__send__(::RSpec::Matchers.last_should, matcher.new(expected))
36
+ else
37
+ eval_match(@actual, operator, expected)
40
38
  end
39
+ end
41
40
 
42
- negative_operator = operator.sub(/^=/, '!')
43
- if negative_operator != operator && respond_to?(negative_operator)
44
- define_method(negative_operator) do |expected|
45
- opposite_should = ::RSpec::Matchers.last_should == :should ? :should_not : :should
46
- raise "RSpec does not support `#{::RSpec::Matchers.last_should} #{negative_operator} expected`. " +
47
- "Use `#{opposite_should} #{operator} expected` instead."
48
- end
41
+ negative_operator = operator.sub(/^=/, '!')
42
+ if negative_operator != operator && respond_to?(negative_operator)
43
+ define_method(negative_operator) do |expected|
44
+ opposite_should = ::RSpec::Matchers.last_should == :should ? :should_not : :should
45
+ raise "RSpec does not support `#{::RSpec::Matchers.last_should} #{negative_operator} expected`. " +
46
+ "Use `#{opposite_should} #{operator} expected` instead."
49
47
  end
50
48
  end
49
+ end
51
50
 
52
- ['==', '===', '=~', '>', '>=', '<', '<='].each do |operator|
53
- use_custom_matcher_or_delegate operator
54
- end
51
+ ['==', '===', '=~', '>', '>=', '<', '<='].each do |operator|
52
+ use_custom_matcher_or_delegate operator
53
+ end
55
54
 
56
- def fail_with_message(message)
57
- RSpec::Expectations.fail_with(message, @expected, @actual)
58
- end
55
+ def fail_with_message(message)
56
+ RSpec::Expectations.fail_with(message, @expected, @actual)
57
+ end
59
58
 
60
- def description
61
- "#{@operator} #{@expected.inspect}"
62
- end
59
+ def description
60
+ "#{@operator} #{@expected.inspect}"
61
+ end
63
62
 
64
- private
63
+ private
65
64
 
66
- if Method.method_defined?(:owner) # 1.8.6 lacks Method#owner :-(
67
- def has_non_generic_implementation_of?(op)
68
- Expectations.method_handle_for(@actual, op).owner != ::Kernel
69
- rescue NameError
70
- false
71
- end
72
- else
73
- def has_non_generic_implementation_of?(op)
74
- # This is a bit of a hack, but:
75
- #
76
- # {}.method(:=~).to_s # => "#<Method: Hash(Kernel)#=~>"
77
- #
78
- # In the absence of Method#owner, this is the best we
79
- # can do to see if the method comes from Kernel.
80
- !Expectations.method_handle_for(@actual, op).to_s.include?('(Kernel)')
81
- rescue NameError
82
- false
83
- end
84
- end
65
+ def uses_generic_implementation_of?(op)
66
+ Expectations.method_handle_for(@actual, op).owner == ::Kernel
67
+ rescue NameError
68
+ false
69
+ end
85
70
 
86
- def eval_match(actual, operator, expected)
87
- ::RSpec::Matchers.last_matcher = self
88
- @operator, @expected = operator, expected
89
- __delegate_operator(actual, operator, expected)
90
- end
71
+ def eval_match(actual, operator, expected)
72
+ ::RSpec::Matchers.last_matcher = self
73
+ @operator, @expected = operator, expected
74
+ __delegate_operator(actual, operator, expected)
91
75
  end
76
+ end
92
77
 
78
+ module BuiltIn
93
79
  class PositiveOperatorMatcher < OperatorMatcher
94
80
  def __delegate_operator(actual, operator, expected)
95
81
  if actual.__send__(operator, expected)
@@ -21,8 +21,6 @@ module RSpec
21
21
  end
22
22
 
23
23
  def _pretty_print(array)
24
- RSpec.deprecate("`RSpec::Matchers::Pretty#_pretty_print`",
25
- :replacement => "`RSpec::Matchers::Pretty#to_sentence`")
26
24
  result = ""
27
25
  array.each_with_index do |item, index|
28
26
  if index < (array.length - 2)
@@ -45,8 +43,6 @@ module RSpec
45
43
  end
46
44
 
47
45
  def expected_to_sentence
48
- RSpec.deprecate("`RSpec::Matchers::Pretty#expected_to_sentence`",
49
- :replacement => "`RSpec::Matchers::Pretty#to_sentence(expected)`")
50
46
  to_sentence(@expected) if defined?(@expected)
51
47
  end
52
48
 
@@ -3,26 +3,9 @@
3
3
  # and a 1.9 bug can lead to infinite recursion from the `super` call in our
4
4
  # method_missing hook. See this gist for more info:
5
5
  # https://gist.github.com/845896
6
- if defined?(MiniTest::TestCase)
7
- MiniTest::TestCase.add_setup_hook do |instance|
8
- unless ::RSpec::Matchers === instance
9
- ::RSpec.deprecate("rspec-expectations' built-in integration with minitest < 5.x",
10
- :replacement => "`include RSpec::Matchers` from within `Minitest::TestCase`")
11
-
12
- MiniTest::TestCase.send(:include, RSpec::Matchers)
13
- end
14
- end
15
- elsif defined?(Test::Unit::TestCase)
16
- Test::Unit::TestCase.class_eval do
17
- def setup
18
- unless ::RSpec::Matchers === self
19
- ::RSpec.deprecate("rspec-expectations' built-in integration with Test::Unit",
20
- :replacement => "`include RSpec::Matchers` from within `Test::Unit::TestCase`")
21
-
22
- Test::Unit::TestCase.send(:include, RSpec::Matchers)
23
- end
24
-
25
- super if defined?(super)
26
- end
27
- end
6
+ if defined?(MiniTest::Unit::TestCase)
7
+ MiniTest::Unit::TestCase.send(:include, RSpec::Matchers)
8
+ end
9
+ if defined?(Test::Unit::TestCase)
10
+ Test::Unit::TestCase.send(:include, RSpec::Matchers)
28
11
  end
@@ -22,12 +22,6 @@ module RSpec
22
22
  }.to raise_error(ArgumentError)
23
23
  end
24
24
 
25
- it 'raises a wrong number of args ArgumentError when given two args' do
26
- expect {
27
- expect(1, 2)
28
- }.to raise_error(ArgumentError, /wrong number of arg/)
29
- end
30
-
31
25
  it 'raises an ArgumentError when given neither an argument nor a block' do
32
26
  expect {
33
27
  expect
@@ -82,62 +76,6 @@ module RSpec
82
76
  }.to raise_error(ArgumentError)
83
77
  end
84
78
  end
85
-
86
- context "when passed a block" do
87
- it 'can be used with a block matcher' do
88
- expect { }.not_to raise_error
89
- end
90
-
91
- context 'when passed a value matcher' do
92
- it 'issues a warning to instruct the user to use a value expression or fix the matcher (for `to`)' do
93
- expect_deprecation_with_call_site(__FILE__, __LINE__ + 1, /block expectation/)
94
- expect { }.to be_an(Object)
95
- end
96
-
97
- it 'issues a warning to instruct the user to use a value expression or fix the matcher (for `not_to`)' do
98
- expect_deprecation_with_call_site(__FILE__, __LINE__ + 1, /block expectation/)
99
- expect { }.not_to be_an(String)
100
- end
101
-
102
- it 'issues a warning to instruct the user to use a value expression or fix the matcher (for `to_not`)' do
103
- expect_deprecation_with_call_site(__FILE__, __LINE__ + 1, /block expectation/)
104
- expect { }.to_not be_an(String)
105
- end
106
-
107
- it 'assumes a custom matcher that does not define `supports_block_expectations?` is not a block matcher (since it is relatively rare)' do
108
- custom_matcher = Module.new do
109
- def self.matches?(value); true; end
110
- def self.description; "foo"; end
111
- end
112
-
113
- expect_deprecation_with_call_site(__FILE__, __LINE__ + 2, /block expectation/)
114
- expect(3).to custom_matcher # to show the custom matcher can be used as a matcher
115
- expect { 3 }.to custom_matcher
116
- end
117
-
118
- it "uses the matcher's `description` in the warning" do
119
- custom_matcher = Module.new do
120
- def self.matches?(value); true; end
121
- def self.description; "matcher-description"; end
122
- end
123
-
124
- expect_deprecation_with_replacement(/\(matcher-description\)/)
125
- expect { }.to custom_matcher
126
- end
127
-
128
- context 'when the matcher does not define `description` (since it is an optional part of the protocol)' do
129
- it 'uses `inspect` in the warning instead' do
130
- custom_matcher = Module.new do
131
- def self.matches?(value); true; end
132
- def self.inspect; "matcher-inspect"; end
133
- end
134
-
135
- expect_deprecation_with_replacement(/\(matcher-inspect\)/)
136
- expect { }.to custom_matcher
137
- end
138
- end
139
- end
140
- end
141
79
  end
142
80
  end
143
81
  end
@@ -32,10 +32,6 @@ describe Object, "#should" do
32
32
  true
33
33
  end
34
34
 
35
- def respond_to?(name, include_all=false)
36
- super || name == :proxied? || @target.respond_to?(name, include_all)
37
- end
38
-
39
35
  def method_missing(name, *args)
40
36
  @target.send(name, *args)
41
37
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  module RSpec
4
2
  describe Expectations do
5
3
  def file_contents_for(lib, filename)
@@ -9,18 +7,6 @@ module RSpec
9
7
  File.read(file)
10
8
  end
11
9
 
12
- it 'has an up-to-date caller_filter file' do
13
- expectations = file_contents_for("expectations", "rspec/expectations/caller_filter.rb")
14
- core = file_contents_for("core", "rspec/core/caller_filter.rb")
15
-
16
- expect(expectations).to eq(core)
17
- end
18
-
19
- it 'prints a deprecation warning when the root file is loaded' do
20
- expect_deprecation_with_call_site(__FILE__, __LINE__ + 1, /rspec-expectations/)
21
- load "rspec-expectations.rb"
22
- end
23
-
24
10
  describe '.method_handle_for(object, method_name)' do
25
11
 
26
12
  class UntamperedClass
@@ -30,18 +16,11 @@ module RSpec
30
16
  end
31
17
 
32
18
  class ClassWithMethodOverridden < UntamperedClass
33
- def method(name)
19
+ def method
34
20
  :baz
35
21
  end
36
22
  end
37
23
 
38
- class ProxyClass < Struct.new(:original)
39
- undef :=~, :method
40
- def method_missing(name, *args, &block)
41
- original.__send__(name, *args, &block)
42
- end
43
- end
44
-
45
24
  if RUBY_VERSION.to_f > 1.8
46
25
  class BasicClass < BasicObject
47
26
  def foo
@@ -64,27 +43,7 @@ module RSpec
64
43
  expect(Expectations.method_handle_for(object, :foo).call).to eq :bar
65
44
  end
66
45
 
67
- it 'fetches method definitions for proxy objects' do
68
- object = ProxyClass.new([])
69
- expect(Expectations.method_handle_for(object, :=~)).to be_a Method
70
- end
71
-
72
- it 'fails with `NameError` when an error is raised when fetching a method from an object that has overriden `method`' do
73
- object = double
74
- allow(object).to receive(:method).and_raise(Exception)
75
- expect {
76
- Expectations.method_handle_for(object, :some_undefined_method)
77
- }.to raise_error(NameError)
78
- end
79
-
80
- it 'fails with `NameError` when a method is fetched from an object that has overriden `method` and is not a method' do
81
- object = ProxyClass.new(double(:method => :baz))
82
- expect {
83
- Expectations.method_handle_for(object, :=~)
84
- }.to raise_error(NameError)
85
- end
86
-
87
- it 'fetches method definitions for basic objects', :if => (RUBY_VERSION.to_i >= 2 && RUBY_ENGINE != 'rbx') do
46
+ it 'fetches method definitions for basic objects', :if => RUBY_VERSION.to_i >= 2 do
88
47
  object = BasicClass.new
89
48
  expect(Expectations.method_handle_for(object, :foo).call).to eq :bar
90
49
  end
@@ -39,39 +39,24 @@ module RSpec::Matchers::BuiltIn
39
39
 
40
40
  end
41
41
 
42
- describe "#failure_message_for_should" do
43
- context "when the parameter to .new is omitted" do
44
- it "describes what was expected" do
45
- matcher_class = Class.new(BaseMatcher) do
46
- def name=(name)
47
- @name = name
48
- end
49
-
50
- def match(expected, actual)
51
- false
52
- end
42
+ describe "#==" do
43
+ it "responds the same way as matches?" do
44
+ matcher = Class.new(BaseMatcher) do
45
+ def initialize(expected)
46
+ @expected = expected
53
47
  end
54
48
 
55
- matcher = matcher_class.new
56
- matcher.name = "be something"
57
- matcher.matches?("foo")
58
- expect(matcher.failure_message_for_should).to eq('expected "foo" to be something')
49
+ def matches?(actual)
50
+ (@actual = actual) == @expected
51
+ end
59
52
  end
60
- end
61
- end
62
53
 
63
- it_behaves_like "an RSpec matcher", :valid_value => 3, :invalid_value => 4 do
64
- matcher_class = Class.new(BaseMatcher) do
65
- def initialize(expected)
66
- @expected = expected
67
- end
54
+ expect(matcher.new(3).matches?(3)).to be_truthy
55
+ expect(matcher.new(3)).to eq(3)
68
56
 
69
- def matches?(actual)
70
- (@actual = actual) == @expected
71
- end
57
+ expect(matcher.new(3).matches?(4)).to be_falsey
58
+ expect(matcher.new(3)).not_to eq(4)
72
59
  end
73
-
74
- let(:matcher) { matcher_class.new(3) }
75
60
  end
76
61
  end
77
62
  end
@@ -31,20 +31,14 @@ describe "expect(...).to be_predicate" do
31
31
  }.to raise_error(NameError, /happy\?/)
32
32
  end
33
33
 
34
- it 'warns of deprecation when :predicate? is private' do
34
+ it 'fails when :predicate? is private' do
35
35
  privately_happy = Class.new do
36
36
  private
37
37
  def happy?
38
38
  true
39
39
  end
40
40
  end
41
- allow(RSpec).to receive(:deprecate)
42
- expect(RSpec).to receive(:deprecate).with(
43
- "matching with be_happy on private method happy?",
44
- :replacement => "`expect(object.send(:happy?)).to be_true` or change the method's visibility to public",
45
- :call_site => RSpec::Mocks::ArgumentMatchers::RegexpMatcher.new(/#{__FILE__}:#{__LINE__ + 2}/)
46
- )
47
- expect(privately_happy.new).to be_happy
41
+ expect { expect(privately_happy.new).to be_happy }.to raise_error
48
42
  end
49
43
 
50
44
  it "fails on error other than NameError" do
@@ -68,26 +62,6 @@ describe "expect(...).to be_predicate" do
68
62
  value = double(:happy? => false)
69
63
  expect(matcher == value).to be false
70
64
  end
71
-
72
- it 'warns of deprecation when actual does not respond to :predicate?' do
73
- oddly_happy_class = Class.new do
74
- def method_missing(method)
75
- return true if method == :happy?
76
- end
77
- end
78
- expect_deprecation_with_call_site(__FILE__, __LINE__ + 1, /Matching with be_happy on an object that doesn't respond to `happy\?`/)
79
- expect(oddly_happy_class.new).to be_happy
80
- end
81
-
82
- it 'does not warn of deprecation when actual responds to present tense predicate' do
83
- present_happy_class = Class.new do
84
- def exists?
85
- true
86
- end
87
- end
88
- expect_no_deprecation
89
- expect(present_happy_class.new).to be_exist
90
- end
91
65
  end
92
66
 
93
67
  describe "expect(...).not_to be_predicate" do
@@ -283,49 +257,6 @@ describe "expect(...).to be_truthy" do
283
257
  end
284
258
  end
285
259
 
286
- describe "expect(...).to be_false" do
287
- it "is deprecated" do
288
- expect_deprecation_with_call_site(__FILE__, __LINE__ + 1, /be_false/)
289
- expect(false).to be_false
290
- end
291
-
292
- it "has the correct call site in the deprecation message" do
293
- expect_deprecation_with_call_site(__FILE__, __LINE__ + 1)
294
- expect(false).to be_false
295
- end
296
-
297
- it "still passes" do
298
- allow(RSpec).to receive(:deprecate)
299
- expect(false).to be_false
300
- end
301
-
302
- it "still fails" do
303
- allow(RSpec).to receive(:deprecate)
304
- expect {
305
- expect(true).to be_false
306
- }.to fail_with(/expected: falsey value/)
307
- end
308
- end
309
-
310
- describe "expect(...).to be_true" do
311
- it "is deprecated" do
312
- expect_deprecation_with_call_site(__FILE__, __LINE__ + 1, /be_true/)
313
- expect(true).to be_true
314
- end
315
-
316
- it "still passes" do
317
- allow(RSpec).to receive(:deprecate)
318
- expect(true).to be_true
319
- end
320
-
321
- it "still fails" do
322
- allow(RSpec).to receive(:deprecate)
323
- expect {
324
- expect(false).to be_true
325
- }.to fail_with(/expected: truthy value/)
326
- end
327
- end
328
-
329
260
  describe "expect(...).to be_falsey" do
330
261
  it "passes when actual equal?(false)" do
331
262
  expect(false).to be_falsey