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
Minor cleaning setting up tests #1875
Conversation
test/asciidoctor_test.rb
Outdated
@@ -1,4 +1,4 @@ | |||
require File.expand_path('helper', __dir__) | |||
require 'test_helper' |
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.
Should we do require_relative 'test_helper'
instead?
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.
I used require
because it's the one I've found in other projects (Rails, Pay) and because is what rubygems use when creating a new gem.
The only issue I could think of is that running tests manually from inside the test
folder (or any other place different from the root path) won't work, as it won't find the file.
Do you foresee any other issue for not using require_relative
?
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.
Those were the issues I was thinking about. The code before could handle those scenarios, right?
I also recall reading relative being faster.
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.
See also puma/puma#2902, puma/puma#2964
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.
Enough arguments 😄 updated to use require_relative
instead
We use minitest for Sinatra's test suite but we weren't using its rake task. I've updated the Rakefile to require and use Minitest default rake task to simplify.
Another change is to rename the
helper.rb
file totest_helper.rb
because I think that name is used more in the community and require it directly without callingFile.expand_path