Капибара получить ошибку `блок (2 уровня) в' - PullRequest
1 голос
/ 08 января 2012

провел целый день с проблемой.

Очень простой тест.Я хочу зайти на главную страницу и проверить, есть ли у нее текст «Match».

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

Запуск спецификации рейка: у меня есть запросы:

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)>'

Не могу это исправить.Это не работает с или без spork и охраны, и сводит меня с ума: (

Мое окружение:

Gemfile:

group :test, :development do 
  gem 'rspec-rails', '2.7.0' , :branch => 'rails3'
  gem 'capybara'
  gem 'guard'
  gem 'guard-rspec'
  gem 'guard-spork'
  gem 'growl'
  gem 'launchy'
  gem 'growl_notify', :require => false if RUBY_PLATFORM =~/darwin/i
  gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~/darwin/i
end

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
...