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

save_and_open_page and spork, spork is loosing test suite / output #226

Open
h0jeZvgoxFepBQ2C opened this issue Apr 9, 2013 · 7 comments

Comments

@h0jeZvgoxFepBQ2C
Copy link

When i run my rspec tests with spork, every time i use capybara's save_and_open_page, spork is loosing the test suite.. or maybe doesnt output anything anymore...

See the log

    # => without save_and_open_page
09:04:24 - INFO - Spork server for RSpec, Test::Unit successfully started

09:04:24 - INFO - Guard::RSpec is running
09:04:24 - INFO - Running all specs
Running tests with args ["--drb", "-f", "progress", "-r", "/Users/myuser/.rvm/gems/ruby-1.9.3-p392/gems/guard-rspec-2.5.2/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec"]...
................

Finished in 4.1 seconds
16 examples, 0 failures


Randomized with seed 50331

Done.

# => with save_and_open_page, no .... are shown anymore
09:04:29 - INFO - Guard is now watching at '/Users/myuser/coding/myproject'
09:04:39 - INFO - Running: spec/features/registration/registration_process_spec.rb
Running tests with args ["--drb", "-f", "progress", "-r", "/Users/myuser/.rvm/gems/ruby-1.9.3-p392/gems/guard-rspec-2.5.2/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec/features/registration/registration_process_spec.rb"]...
Done.

# => without save_and_open_page, also no .... anymore (after restart it works again)
[1] guard(main)> Running tests with args ["--drb", "-f", "progress", "-r", "/Users/myuser/.rvm/gems/ruby-1.9.3-p392/gems/guard-rspec-2.5.2/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec/features/registration/registration_process_spec.rb"]...
Done.

      # => here i added some errors into my code... still no error message shown...
[1] guard(main)> Running tests with args ["--drb", "-f", "progress", "-r", "/Users/myuser/.rvm/gems/ruby-1.9.3-p392/gems/guard-rspec-2.5.2/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec/features/registration/registration_process_spec.rb"]...
Done.

# only works again after restarting spork

Any suggestions?

@h0jeZvgoxFepBQ2C
Copy link
Author

See also here (no answer at the moment, but 5 people voted for it):

http://stackoverflow.com/questions/15895522/save-and-open-page-and-spork-spork-is-loosing-test-suite-output

@hjblok
Copy link

hjblok commented May 14, 2013

I'm also having this issue. Is there already a solution? What can I do to debug this problem?

@h0jeZvgoxFepBQ2C
Copy link
Author

no i didnt found anything unfortunately :/

@pascalhuynh
Copy link

I'm also having this issue...

@h0jeZvgoxFepBQ2C
Copy link
Author

Added also an issue on the capybara github page teamcapybara/capybara#1086

@h0jeZvgoxFepBQ2C
Copy link
Author

RDX posted following on stackoverflow:

Somehow your STDOUT is getting replaced with some other buffer. So whatever is being written by Capybara to STDOUT is getting ignored or consumed somewhere else.

Try the following:

# Add global before/after blocks
before :each do
  @old_stdout, @old_stderr = STDOUT, STDERR
end

after :each do
  STDOUT,  STDERR  = @old_stdout, @old_stderr

  # Some gems use $stdout and $stderr, instead of STDOUT and STDERR, replace those too
  $stdout, $stderr = @old_stdout, @old_stderr
end

Capybara's save_and_open_page uses Launchy gem. So I believe the STDOUT and STDERR are getting stubbed in one of these gems.

@halloffame
Copy link

I'm having the same issue. It seems like it is still running in the background, its just that nothing after the save_and_open_page gets printed, until you restart guard in my case.

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