-
Notifications
You must be signed in to change notification settings - Fork 65
Deprecate usage of should_not raise_error
#50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
| before :all do | ||
| path = RbConfig::CONFIG['bindir'] | ||
| exe = RbConfig::CONFIG['ruby_install_name'] | ||
| file = File.dirname(__FILE__) + '/should.rb' | ||
| file = File.dirname(__FILE__) + '/should.rb 2>&1' | ||
|
||
| @out = `#{path}/#{exe} #{file}` | ||
| end | ||
|
|
||
|
|
@@ -45,17 +45,21 @@ | |
| No behavior expectation was found in the example | ||
| EOS | ||
| end | ||
|
|
||
| it 'prints a deprecation message about using `{}.should_not raise_error`' do | ||
| @out.should include "Deprecation: ->{}.should_not raise_error breaks code style and is deprecated" | ||
| end | ||
| end | ||
|
|
||
| it "prints status information" do | ||
| @out.should include ".FF..FF." | ||
| end | ||
|
|
||
| it "prints out a summary" do | ||
| @out.should include "0 files, 8 examples, 6 expectations, 4 failures, 0 errors" | ||
| @out.should include "0 files, 9 examples, 7 expectations, 4 failures, 0 errors" | ||
| end | ||
|
|
||
| it "records expectations" do | ||
| @out.should include "I was called 6 times" | ||
| @out.should include "I was called 7 times" | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should show the caller here, so it's easy to know where it comes from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use MSpec.deprecate (
mspec/lib/mspec/utils/deprecate.rb
Line 2 in 47e3cbf
That will automatically include the caller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replacementcan be e.g. "a matcher to verify the result"Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, will try. I saw this helper but decided not to use it because it has a little bit different purpose - to notify about changing in API or DSL. But here we have a code style issue.
Nevertheless it should work well for our case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done