RSpec 2.13.1挂在Ruby 1.9.3中,包含Rails 3.2.13和Spork 1.0.0rc3

时间:2013-04-30 03:02:23

标签: ruby-on-rails ruby rspec spork

尝试通过升级宝石来复活旧项目。进入RSpec在启动时使用'--drb'选项挂起的问题。

单凭'rspec spec'可以正常工作。但是在另一个终端开始'spork'然后'rspec --drb spec'将CPU调高到大约40%并且只是坐下。

使用Rails 3.2.13,Ruby 1.9.3-p392,RSpec 2.13.1和spork-rails 3.2.1,它取决于Spork 1.0.0rc3。

的Gemfile

source 'http://rubygems.org'

gem 'rails', '~> 3.2.13'

gem 'devise', '~> 2.2.0'
gem 'event-calendar', :require => 'event_calendar'
gem 'has_scope'
gem 'high_voltage'
gem 'inherited_resources'
gem 'jquery-rails'
gem 'kaminari'
gem 'ransack'
gem 'simple_form'
gem 'validates_timeliness'

# deployment process management
gem 'foreman'
gem 'thin'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails', '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '< 2.0'
  gem 'bootstrap-sass', '~> 2.3.1'
end

group :production do
  gem 'pg'
end

group :development, :test do
  gem 'factory_girl_rails', '~> 4.2.0'
  gem 'rspec-rails', '~> 2.13.1'
  gem 'spork-rails'
  gem 'sqlite3'
end

group :test do
  gem 'capybara'
  gem 'growl'
  gem 'launchy'
  gem 'ruby-prof'
  gem 'test-unit'
end

规格/ spec_helper.rb

require 'rubygems'
require 'spork'
#uncomment the following line to use spork with the debugger
#require 'spork/ext/ruby-debug'

Spork.prefork do

  # Prevent Devise from loading the User model super early with it's routes
  # see: https://github.com/sporkrb/spork/wiki/Spork.trap_method-Jujitsu
  require "rails/application"
  Spork.trap_method(Rails::Application::RoutesReloader, :reload!)

  # This file is copied to spec/ when you run 'rails generate rspec:install'
  ENV["RAILS_ENV"] ||= 'test'

  require File.expand_path("../../config/environment", __FILE__)
  require 'rspec/rails'
  require 'rspec/autorun'

  # Since I have included Test::Unit for perfomance tests, disable auto-run
  Test::Unit::AutoRunner.need_auto_run = false if defined?(Test::Unit::AutoRunner)

  # Requires supporting ruby files with custom matchers and macros, etc,
  # in spec/support/ and its subdirectories.
  Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

  RSpec.configure do |config|
    # ## Mock Framework
    #
    # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
    #
    # config.mock_with :mocha
    # config.mock_with :flexmock
    # config.mock_with :rr

    # If you're not using ActiveRecord, or you'd prefer not to run each of your
    # examples within a transaction, remove the following line or assign false
    # instead of true.
    config.use_transactional_fixtures = true

    # If true, the base class of anonymous controllers will be inferred
    # automatically. This will be the default behavior in future versions of
    # rspec-rails.
    config.infer_base_class_for_anonymous_controllers = false

    # Run specs in random order to surface order dependencies. If you find an
    # order dependency and want to debug it, you can fix the order by providing
    # the seed, which is printed after each run.
    #     --seed 1234
    config.order = "random"
  end

end

Spork.each_run do
  # This code will be run each time you run your specs.

end

我没有在控制台上收到任何错误消息或反馈,所以我甚至不知道从哪里开始寻找问题。有什么建议吗?

1 个答案:

答案 0 :(得分:1)

通过brew update ruby-build升级ruby-build,获得了2013-05-01的新版本。更新后,我删除并重新安装了所有我的红宝石,问题似乎已经解决了。

我不知道具体解决了什么问题,但这里有一些注释和相关提交:https://github.com/sstephenson/ruby-build/commit/9f8d53365aef52c940095f583cdc82f02caba90f