File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ def should_not(matcher = NO_MATCHER_GIVEN)
2323 raise "should_not outside example" unless state
2424 MSpec . actions :expectation , state
2525
26+ if RaiseErrorMatcher === matcher
27+ $stderr. puts "\n Deprecation: ->{}.should_not raise_error breaks code style and is deprecated"
28+ end
29+
2630 if NO_MATCHER_GIVEN . equal? ( matcher )
2731 SpecNegativeOperatorMatcher . new ( self )
2832 else
Original file line number Diff line number Diff line change @@ -70,4 +70,8 @@ def finish
7070 it "invokes the MSpec :expectation actions" do
7171 1 . should_not == 2
7272 end
73+
74+ it "deprecates using `{}.should_not raise_error`" do
75+ -> { } . should_not raise_error
76+ end
7377end
Original file line number Diff line number Diff line change 55 before :all do
66 path = RbConfig ::CONFIG [ 'bindir' ]
77 exe = RbConfig ::CONFIG [ 'ruby_install_name' ]
8- file = File . dirname ( __FILE__ ) + '/should.rb'
8+ file = File . dirname ( __FILE__ ) + '/should.rb 2>&1 '
99 @out = `#{ path } /#{ exe } #{ file } `
1010 end
1111
4545No behavior expectation was found in the example
4646EOS
4747 end
48+
49+ it 'prints a deprecation message about using `{}.should_not raise_error`' do
50+ @out . should include "Deprecation: ->{}.should_not raise_error breaks code style and is deprecated"
51+ end
4852 end
4953
5054 it "prints status information" do
You can’t perform that action at this time.
0 commit comments