所有使用水豚的 SauceLabs 测试 运行 结果为 "Unnamed Ruby job" 并且没有元数据

All SauceLabs tests run with Capybara result in "Unnamed Ruby job" and no metadata

我正在设置与 SauceLabs 集成的独立 RSpec/Capybara 测试套件,但 the documentation 中的说明似乎对我不起作用。

以下是我的spec_helper.rb的相关部分:

require 'capybara'
require 'capybara/rspec'
require 'sauce/capybara'

Sauce.config do |config|
  config[:browsers] = [
    [ "OSX 10.10", "Safari", "8" ]
  ]
end

Capybara.default_driver = :sauce

这是功能 (not_found_spec.rb):

feature 'Enroll: 404', :sauce => true do
  before :each do
    @nonexistent_curriculum = FactoryGirl.build :curriculum
    @enroll = Enroll.new
  end

  context 'When I visit a page that does not exist' do
    scenario 'I see a Not Found message' do
      @enroll.go @nonexistent_curriculum
      expect(@enroll.not_found).to be_visible
    end
  end
end

当我然后 运行 rspec 时,规范 运行 并通过,但没有记录任何类型的元数据。我在 SauceLabs 上只看到 "Unnamed Ruby job".

我错过了什么?

当你运行

 bundle exec rake sauce:install:spec

它会创建一个 sauce_helper.rb,然后通常需要从 rails_helper.rb 或 spec_helper.rb 的末尾开始,具体取决于您拥有的 *_helper.rb 文件。看起来您将 sauce_helper 中的 Sauce 配置部分复制到了您的 spec_helper 中,但您没有显示您有

require "sauce"

在生成的 sauce_helper 中。不需要 "sauce" 可能是 sauce/rspec/rspec.rb 不是必需的,这是 rspec 的所有挂钩用于测试 sauce: true 的地方。