File tree 3 files changed +13
-1
lines changed
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)
23
23
raise "should_not outside example" unless state
24
24
MSpec . actions :expectation , state
25
25
26
+ if RaiseErrorMatcher === matcher
27
+ $stderr. puts "\n Deprecation: ->{}.should_not raise_error breaks code style and is deprecated"
28
+ end
29
+
26
30
if NO_MATCHER_GIVEN . equal? ( matcher )
27
31
SpecNegativeOperatorMatcher . new ( self )
28
32
else
Original file line number Diff line number Diff line change @@ -70,4 +70,8 @@ def finish
70
70
it "invokes the MSpec :expectation actions" do
71
71
1 . should_not == 2
72
72
end
73
+
74
+ it "deprecates using `{}.should_not raise_error`" do
75
+ -> { } . should_not raise_error
76
+ end
73
77
end
Original file line number Diff line number Diff line change 5
5
before :all do
6
6
path = RbConfig ::CONFIG [ 'bindir' ]
7
7
exe = RbConfig ::CONFIG [ 'ruby_install_name' ]
8
- file = File . dirname ( __FILE__ ) + '/should.rb'
8
+ file = File . dirname ( __FILE__ ) + '/should.rb 2>&1 '
9
9
@out = `#{ path } /#{ exe } #{ file } `
10
10
end
11
11
45
45
No behavior expectation was found in the example
46
46
EOS
47
47
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
48
52
end
49
53
50
54
it "prints status information" do
You can’t perform that action at this time.
0 commit comments