Closed PragTob closed 4 years ago
It looks like what you want is the effect of Bundler.with_clean_env
(described in the Shelling out section of bundle help exec
.
Aruba already tries to do something like that with its #unset_bundler_env_vars
method, but recent experience with rspec-rails
show that it's not doing its job. If it were doing its job, you could add the tag @disable-bundler
to the scenario and that would be that. In the end, some code was added to rspec-rails
to handle this: https://github.com/rspec/rspec-rails/commit/f9873aaa06494def8a577ecb4380115f0e6b99bc.
I really want to fix this in Aruba itself. Chances are that will be in version 1.0. Coming soon, I hope.
@mvz thanks for all the background and help! Sadly, @disable-bundler
isn't working (much like you suspected) - I'll give the workaround from rspec a shot. Thanks!
@mvz thanks, the rspec-rails workaround works for me/us :ok_hand: Adapted it a little bit: https://github.com/colszowka/simplecov/pull/814/files#diff-a5541ecebed4f51eb37fffc180511ee7
Thanks a bunch! :green_heart:
@deivid-rodriguez not sure if you meant to close this one? While we've fixed it in simplecov my understanding was that @mvz wanted to explore a way to make it possible without freedom patching in aruba 1.0 :)
Definitely not, not sure how that happened.
I think it was me formulating a commit message to that the magic fix
targeted this, I guess when you merged it to your fork master it took you rights here to close it.
It's a fun world.
Yeah, that looks like what happened :man_shrugging:
~I'm trying to reproduce this as a small test case and I'm confused how Travis is supposed to know it needs to install parallel_tests
.~ Ah found it: "Given I install dependencies". Makes sense :slightly_smiling_face:.
Do you mean in simplecov? It's included in the test project's Gemfile: https://github.com/colszowka/simplecov/blob/7b4235cc4f9db9c37b75e7ec51364508e4cd3e28/test_projects/parallel_tests_project/Gemfile.
Oh, you figured it out, great :)
The suggested method using @disable-bundler
does work with Aruba master. I made a pull request: https://github.com/colszowka/simplecov/pull/827.
Closing this as disabling Bundler works in master.
Hello there and thanks for aruba :green_heart:
My question/scenario might be a bit weird but I'll try either way. Code ref: https://github.com/colszowka/simplecov/pull/814 (PR where I stumbled upon this problem trying to implement something)
This is a request for "How do I do this? Can I do this?" not "please change the way you're doing things"
Versions
Ruby: 2.7 Aruba: 0.14.14
Context
SimpleCov. We need to make sure SimpleCov works in many different contexts as such we have a "fake project" that we run tests in and then want to make sure the returned coverage results for running tests there are right.
To do this, we have a slightly awkward
Before
hook replacing the project contents with the faked project of our choice (note: I didn't write this and in general, better ways of doing this are welcome :D )(adapted in the current PR to support different projects)
Problem
To the best of my knowledge/debugging aruba executes command like
bundle
orbundle exec parallel_rspec spec
in the context of the bundle of the original app (simplecov, not our faked project). Commands are run via "When I successfully runcmd
"output captured from running the cucumber tests (from the PR):
output when manually running the command in the
tmp/aruba/project
folder:Notice not only how it works but that the installed gems are also different.
I want the commands to execute in the context of the faked project so that I can have the gems listed only in its Gemfile and that the
bundle exec
in there then works.The reason why I want have my dependencies separate in this example projects is because short to long term I want to test against different versions of Rails or parallel tests or what not. Theoretically I could switch on some environment variables in the Gemfile as a workaround but I'd really prefer if they were more isolated.
I think that's it, happy to give more background etc. and again thanks for your help and your project! :tada: