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

RSpec + Spork on Win give no output #251

Open
drobazko opened this issue Jan 13, 2014 · 9 comments
Open

RSpec + Spork on Win give no output #251

drobazko opened this issue Jan 13, 2014 · 9 comments

Comments

@drobazko
Copy link

I posted the question on stackoverflow. But without answer.
Rails 3.2.12
Spork 0.9.2
Rspec 2.14.1

I have a sample test spec/models/user_spec.rb

require 'spec_helper'

describe User do
  pending "add some examples to (or delete) #{__FILE__}"
end

spec/spec_helper.rb

require 'spork'

Spork.prefork do
  ENV["RAILS_ENV"] ||= 'test'
  require File.expand_path("../../config/environment", __FILE__)
  require 'rspec/rails'
  require 'rspec/autorun'

  Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

  RSpec.configure do |config|
    config.fixture_path = "#{::Rails.root}/spec/fixtures"
    config.use_transactional_fixtures = true
    config.infer_base_class_for_anonymous_controllers = false
    config.order = "random"
    config.color_enabled = true
    config.tty = true
    config.formatter = :documentation # :progress, :html, :textmate  
  end
end

Spork.each_run do
end

When I run the test without Spork I get:

$ rspec
c:/ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support
/dependencies.rb:251:in `block in require': iconv will be deprecated in the futu
re, use String#encode instead.
User
  add some examples to (or delete) d:/sites/efiling/spec/models/user_spec.rb (PE
NDING: No reason given)

Pending:
  User add some examples to (or delete) d:/sites/efiling/spec/models/user_spec.r
b
    # No reason given
    # ./spec/models/user_spec.rb:4

Finished in 0.31249 seconds
1 example, 0 failures, 1 pending

Randomized with seed 10437

When I run the test with Spork I get:

$ rspec . --drb
  <-- Slave(1) run done!

In Spork window:

Loading Spork.prefork block...
  --> DRb magazine_slave_service: 1 provided...
Running tests with args ["--color", "."]...
  <-- take tuple(1); slave.run...
   -- (1);run done
Done.

   -- build slave 1...
Preloading Rails environment

Why does Rspec give no info about pending, failed etc tests when I use it with Spork?

@cforcey
Copy link

cforcey commented Feb 16, 2014

UPDATE: This seems to be related to #248 -- changes in spec output handling.

With Rails 4.1.0.beta1 and jRuby 1.7.10 on Mac OSX 10.9 I am getting the same behavior. My Gemfile.lock is here. Same behavior when I get spork-rails and spark from their respective github master branches. Thanks for any insight you can provide.

# rspec terminal session
bundle exec rspec --drb spec/models/unit_spec.rb
zsh: correct 'rspec' to 'spec' [nyae]? n
  <-- Slave(2) run done!
# Spork output
[master][~/Dev/hbook] bundle exec spork
Using RSpec, Rails
  -- Starting to fill pool...
     Wait until at least one slave is provided before running tests...
  ** CTRL+BREAK to stop Spork and kill all ruby slave processes **
Spork is ready and listening on 8989!
Preloading Rails environment
Preloading Rails environment
Loading Spork.prefork block...
Loading Spork.prefork block...
Running tests with args ["--color", "--profile", "--order", "random", "spec/models/unit_spec.rb"]...
  <-- take tuple(2); slave.run...
   -- build slave 2...
  --> DRb magazine_slave_service: 2 provided...
*

Pending:
  Unit add some examples to (or delete) /Users/cforcey/Dev/hbook/spec/models/unit_spec.rb
    # No reason given
    # ./spec/models/unit_spec.rb:4

Top 1 slowest examples (0.002 seconds, 100.0% of total time):
  Unit add some examples to (or delete) /Users/cforcey/Dev/hbook/spec/models/unit_spec.rb
    0.002 seconds ./spec/models/unit_spec.rb:4

Finished in 0.214 seconds
1 example, 0 failures, 1 pending

Randomized with seed 21535

   -- (2);run done
Done.

@llimllib
Copy link

I get almost the same thing, with Rails 4.0.4, rspec 3.0.0.beta2, and ruby 2.1.1p76 on a Mac.

I actually get even less output than you guys do. The spork server:

$ spork
Using RSpec, Rails
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
Running tests with args ["--color", "spec"]...
Done.

Running tests with args ["--color", "spec"]...
Done.

In the terminal where I run the client:

$ rspec spec --drb
$

I have an odd wrinkle, where if I run spork -d, I get a bunch of backtraces.

The line in spec_helper which causes the backtraces is the one which loads environment.rb. When I require that file from an irb console, it is successfully executed.

this is what my spec_helper.rb looks like.

If I can be of any help debugging, please let me know.

@hx
Copy link

hx commented Mar 28, 2014

+1

@llimllib
Copy link

I created a stupid simple rails app to reproduce the problem.

Can somebody else run spork on this repo and confirm that they do not get output?

In the meantime, I'm working on debugging (knowing nothing about spork)

@llimllib
Copy link

I have given up and am using zeus instead

@joshuaballoch
Copy link

I am also getting this. Anyone find a solution yet?

@llimllib
Copy link

@joshuaballoch use zeus or spring

@drobazko
Copy link
Author

@llimllib , zeus and spring has no Windows support.

@joshuaballoch
Copy link

This may be a bit of a hack, but I found this to fix the stdout issue.
add this to the each_run block for spork:

  if Spork.using_spork?
    RSpec.configure do |config|
      config.reset
      config.output_stream = $stdout
    end
  end

more info at http://stackoverflow.com/questions/22239382/how-can-i-configure-rspec-to-show-output-with-spork

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

5 participants