Search code examples
rubyrspeccapybarasaucelabs

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


I'm setting up a standalone RSpec/Capybara test suite integrated with SauceLabs, but the instructions in the documentation don't seem to be working for me.

Here are the relevant parts of my 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

And here's the feature (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

When I then run rspec, the specs run and pass, but no metadata of any kind is recorded. All I see on SauceLabs is "Unnamed Ruby job".

What am I missing?


Solution

  • When you run

     bundle exec rake sauce:install:spec
    

    it creates a sauce_helper.rb which is then typically required from the end of your rails_helper.rb or spec_helper.rb depending on what *_helper.rb files you have. It looks like you copied the Sauce config part from sauce_helper into your spec_helper but you haven't shown that you have

    require "sauce"
    

    in there which is in the generated sauce_helper. Without requiring "sauce" it may be that sauce/rspec/rspec.rb is not getting required which is where all the hooks into rspec for tests with sauce: true are set up.