ruby 2.1.4、rails 4.1.12、rspec (2.14.1)、capybara (2.4.1)およびを使用して機能テストを作成していますpoltergeist (1.5.1)。
現在、次のような機能があります。
require 'spec_helper'
feature 'user is able to import videos from YouTube Channel', js: true do
  before do
    @user = FactoryGirl.create :user
  end
  scenario 'from a simple correct YouTube video link' do
    VCR.use_cassette('video_sources/youtube_add_single_video') do
      visit root_path
      fill_in 'user_email',    with: @user.email
      fill_in 'user_password', with: @user.password
      click_button 'Log in'
      visit youtube_import_path
      expect(page).to have_css("input#query")
      expect(page).to have_css("a#continue-button")
      fill_in "query", with: "https://www.youtube.com/watch?v=xZY43QSx3Fk"
      page.find('#continue-button').trigger('click')
      # clicking on '#continue-button' call youtube API
      # receive a video data and store it into DB
      expect(page).to have_content("Congrats! Your import is complete")
    end
  end
end
ローカルではすべて正常に動作し、すべてのテストは緑色です。しかし CodeShip では、このシナリオは常に失敗します。そして、私は理由を見つけることができません...
CodeShip のログには次のように書かれています。
Capybara::Poltergeist::StatusFailError:
Request to 'http://127.0.0.1:3000/' failed to reach server, check DNS and/or server status
しかし、なぜ?ローカルではすべてのテストが緑色です。
PSsleep 5行の前に追加しようとvisit root_pathしましたが、役に立ちませんでした。
PSS のこの部分spec_helper.rbが役立つかもしれません。
  config.before(:suite) do
    DatabaseCleaner.clean_with(:truncation)
    Capybara.reset_sessions!
  end
  config.before(:each) do
    DatabaseCleaner[:mongoid].start
  end
  config.after(:each) do
    DatabaseCleaner[:mongoid].clean
  end
  config.after(:suite) do
    Rails.cache.clear
  end