Skip to content

RSpec + Spork on Win give no output #251

Open

Description

@drobazko

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?

Activity

  1. cforcey commented on Feb 16, 2014

    @cforcey

    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.
    
  2. llimllib commented on Mar 25, 2014

    @llimllib

    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.

  3. hx commented on Mar 28, 2014

    @hx

    +1

  4. llimllib commented on Mar 29, 2014

    @llimllib

    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)

  5. llimllib commented on Mar 29, 2014

    @llimllib

    I have given up and am using zeus instead

  6. joshuaballoch commented on Apr 16, 2014

    @joshuaballoch

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

  7. llimllib commented on Apr 16, 2014

    @llimllib
  8. drobazko commented on Apr 17, 2014

    @drobazko
    Author

    @llimllib , zeus and spring has no Windows support.

  9. joshuaballoch commented on Apr 17, 2014

    @joshuaballoch

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions