Skip to content
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

prevent rspec_guard_result #247

Closed
brewster1134 opened this issue Jan 24, 2014 · 21 comments
Closed

prevent rspec_guard_result #247

brewster1134 opened this issue Jan 24, 2014 · 21 comments

Comments

@brewster1134
Copy link

when running my specs, the rspec_guard_result is created. some of my specs use chdir and so the file gets created in several places. it seems to only be a summary and is not very helpful.

it seems to come from when the guard-rspec specs run... i don't know why (or when) they are even running, but is it possible to disable generating this?

@thibaudgg
Copy link
Member

It's currently used for notification and failed_mode purpose and there's no way of avoid it yet. Maybe we could use chdir as well to prevent your issue. @907th what do you think?

@907th
Copy link
Contributor

907th commented Jan 24, 2014

@thibaudgg I think it is sufficient to use absolute path to temporary file (we're using relative one now).
@brewster1134 I fixed guard-rspec formatter to use absolute path to rspec_guard_result file in PR #248. Could you please try it?

@thibaudgg
Copy link
Member

👍

@brewster1134
Copy link
Author

👍 No more duplicate logs being created throughout the project.

@brewster1134
Copy link
Author

I just noticed that the spec updates throw a warning now...

warning: already initialized constant Guard::RSpec::Formatter::TEMPORARY_FILE_PATH

@907th
Copy link
Contributor

907th commented Jan 25, 2014

@brewster1134 It's strange, I'll check it later.

@brewster1134
Copy link
Author

Actually looking at the output closer... its because both ver. 4.2.4 AND your branch are being loaded. I am just pointing to your branch through bundler. strange..

gem 'guard-rspec', github: '907th/guard-rspec'
.../guard-rspec-6e1852c87fb9/lib/guard/rspec/formatter.rb:7: warning: already initialized constant Guard::RSpec::Formatter::TEMPORARY_FILE_PATH
.../guard-rspec-4.2.4/lib/guard/rspec/formatter.rb:7: warning: previous definition of TEMPORARY_FILE_PATH was here

@907th
Copy link
Contributor

907th commented Jan 26, 2014

@brewster1134 I noticed you use master branch in my repository, but you should use branch fix_247.

gem 'guard-rspec', github: '907th/guard-rspec', branch: 'fix_247'

Its hash is f8f599c2ede4b (not 6e1852c87fb9)

@907th
Copy link
Contributor

907th commented Jan 26, 2014

@brewster1134 Also try running specs with bundler

@brewster1134
Copy link
Author

nice catch with the branch! and running specs with bundler was it. i thought running guard through bundler was all that was needed. i look forward to that branch getting merged. thanks

@907th 907th closed this as completed in f8f599c Jan 26, 2014
907th pushed a commit that referenced this issue Jan 26, 2014
Fix #247: Use absolute path for temporary file
@907th
Copy link
Contributor

907th commented Jan 26, 2014

@brewster1134 @thibaudgg The fix was merged!

@thibaudgg
Copy link
Member

Thanks, 2.4.5 released!

@907th what is your rubygems email account? So I can add you to https://rubygems.org/gems/guard-rspec :)

@kurtfunai
Copy link

I saw that this is fixed via using bundler to run rspec, but what if I want to run the tests with Spring?

guard :rspec, cmd:'spring rspec' do

WIth guard-rspec-4.2.8 I am still running into this issue:

.../guard-rspec-4.2.8/lib/guard/rspec/formatter.rb:7: warning: already initialized constant Guard::RSpec::Formatter::TEMPORARY_FILE_PATH
...guard-rspec-4.2.4/lib/guard/rspec/formatter.rb:7: warning: previous definition of TEMPORARY_FILE_PATH was here

@907th
Copy link
Contributor

907th commented May 9, 2014

@kurtfunai I think it was fixed by #261... But it is only in master branch of guard-rspec and was not released...

UPD: I've just released 4.2.9 with the fix for the issue. But I think you will still be seeing the warning until you delete one of 4.2.4 or 4.2.8 versions of guard-rspec... or both

@kurtfunai
Copy link

@907th thank you, and thanks again for getting back to me so quickly! 😀

@907th
Copy link
Contributor

907th commented May 9, 2014

But it is very interesting question for me: Why do rspec loads different versions of guard-rspec's formatter simultaneously?
@thibaudgg Don't you know why?

@907th
Copy link
Contributor

907th commented May 9, 2014

@kurtfunai I broke my head trying to reproduce the issue. Can you provide me steps with doing that?

I suppose that guard and rspec load different versions of guard-rspec. But I can't understand how this is possible.

@kurtfunai
Copy link

@907th I upgraded to 4.2.9 and it seemed to resolve the issue! I no longer get the double load error.

@thibaudgg
Copy link
Member

@907th the double load is maybe coming from bundler?

@907th
Copy link
Contributor

907th commented May 12, 2014

@thibaudgg I think the following happens:

  • guard starts without bundler and loads guard-rspec 4.2.4
  • guard calls rspec -r <path-to-formatter-from-guard-rspec-4.2.4>
  • rspec requires formatter from guard-rspec 4.2.4
  • rspec loads app configuration
  • app configuration calls Bundler.require
  • bundler requires guard-rspec 4.2.8
  • BOOOM! Constant TEMPORARY_FILE_PATH is being redeclared

But I was not able to reproduce such behaviour :(

I assume that Gemfile contains gem 'guard-rspec', '4.2.8' but both 4.2.4 and 4.2.8 versions installed.

@thibaudgg
Copy link
Member

@907th thanks for the steps, seems very likely.

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

No branches or pull requests

4 participants