Selenium 水豚在中获取错误“块(2级)”

Selenium 水豚在中获取错误“块(2级)”,selenium,tdd,capybara,rails-3.1,Selenium,Tdd,Capybara,Rails 3.1,花了一整天的时间解决这个问题 非常简单的测试。我想访问主页并检查它是否有文本匹配 require 'spec_helper' describe "Sign in" do it "should sign in with correct data", :js => true do visit root_path page.should have_content("Match") end end 运行rake规范:我收到的请求: 1) Sign in should s

花了一整天的时间解决这个问题

非常简单的测试。我想访问主页并检查它是否有文本匹配

require 'spec_helper'

describe "Sign in" do
  it "should sign in with correct data", :js => true do
    visit root_path
    page.should have_content("Match")
  end
end
运行rake规范:我收到的请求:

1) Sign in should sign in with correct data
     Failure/Error: visit root_path
     Timeout::Error:
       Timeout::Error
     # ./spec/requests/signin_spec.rb:5:in `block (2 levels) in <top (required)>'
spec_helper.rb:

require 'rubygems'
require 'spork'


Spork.prefork do 

  ENV["RAILS_ENV"] ||= 'test'
  require File.expand_path("../../config/environment", __FILE__)

  require 'rspec/rails'
  # Add this to load Capybara integration:
  require 'capybara/rspec'
  require 'capybara/rails'


  # 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|
    # Loading more in this block will cause your tests to run faster. However,
    # if you change any configuration or code from libraries loaded here, you'll
    # need to restart spork for it take effect.
    # == 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
    config.mock_with :rspec

    # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
    config.fixture_path = "#{::Rails.root}/spec/fixtures"

    # 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 = false

    # 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



    #config.treat_symbols_as_metadata_keys_with_true_values = true
    #config.filter_run :focus => true
    #config.run_all_when_everything_filtered = true
  end  
end

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

问题出在FF版本中-太新了。我刚刚把它降到了3.6级,所有的功能都很有魅力
require 'rubygems'
require 'spork'


Spork.prefork do 

  ENV["RAILS_ENV"] ||= 'test'
  require File.expand_path("../../config/environment", __FILE__)

  require 'rspec/rails'
  # Add this to load Capybara integration:
  require 'capybara/rspec'
  require 'capybara/rails'


  # 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|
    # Loading more in this block will cause your tests to run faster. However,
    # if you change any configuration or code from libraries loaded here, you'll
    # need to restart spork for it take effect.
    # == 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
    config.mock_with :rspec

    # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
    config.fixture_path = "#{::Rails.root}/spec/fixtures"

    # 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 = false

    # 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



    #config.treat_symbols_as_metadata_keys_with_true_values = true
    #config.filter_run :focus => true
    #config.run_all_when_everything_filtered = true
  end  
end

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