Skip to content

Use require_relative instead of require for 'test_plugin_helper'#44

Merged
timogoebel merged 1 commit intomasterfrom
43-enable-running-single-tests
Oct 18, 2018
Merged

Use require_relative instead of require for 'test_plugin_helper'#44
timogoebel merged 1 commit intomasterfrom
43-enable-running-single-tests

Conversation

@leewaa
Copy link
Copy Markdown
Contributor

@leewaa leewaa commented Oct 17, 2018

close #43

@leewaa leewaa requested a review from timogoebel October 18, 2018 08:46
Copy link
Copy Markdown
Member

@timogoebel timogoebel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has some downsides, but I'm ok with it for now if it makes testing easier.

@timogoebel timogoebel merged commit f5f11ce into master Oct 18, 2018
@leewaa
Copy link
Copy Markdown
Contributor Author

leewaa commented Oct 18, 2018

@timogoebel Can you elaborate on the downsides ?

@leewaa leewaa deleted the 43-enable-running-single-tests branch October 18, 2018 12:50
@timogoebel
Copy link
Copy Markdown
Member

@leewaa: I don't like it because it's odd to use the relative path to go back to the "root-path". I guess I just don't like the developer experience.
I'm wondering if it's possible to just extend the include path of ruby to make it find the test_helper.

If I run be bin/rake test:foreman_dlm, it also explicitly sets the include path:

/ruby -I"lib:test:/Users/f0218175/foremandev/foreman_dlm/lib/tasks/../../test" -I"/Users/f0218175/.rvm/gems/ruby-2.5.0/gems/rake-12.3.1/lib" "/Users/f0218175/.rvm/gems/ruby-2.5.0/gems/rake-12.3.1/lib/rake/rake_test_loader.rb"

My gut feeling tells me, the proper approach is to try to do the same. But I'd need to dig into this to know for sure.

@leewaa
Copy link
Copy Markdown
Contributor Author

leewaa commented Oct 18, 2018

Ok I see.

Well I did a hunt around to be totally sure its not going to cause us any problems (still can't know for sure). Checkout this thread on Stack overflow. Its usage is not clearly defined however some seem to think that require_relative is for requiring files local to the project, and require for files in external libraries, but that is still disputed I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use require_relative for test_plugin_helper

2 participants