sauce-archives / sauce_ruby

This is the Ruby client adapter for testing with Sauce Labs, a Selenium-based browser testing service (saucelabs.com).
Apache License 2.0
98 stars 115 forks source link

Sauce gem always fails with uninitialized constant Sauce::RSpec::Spec #338

Closed bootstraponline closed 9 years ago

bootstraponline commented 9 years ago

I'm using rspec 3.3 and the sauce_ruby gem always fails with uninitialized constant Sauce::RSpec::Spec. I added a trace point and tracked the issue down to sauce_ruby's rspec_one_support

Why is rspec 1 even supported? The last rspec 1 release was April 11, 2011.

begin
  require 'spec'
  module Sauce
    module RSpec
      class SeleniumExampleGroup < Spec::Example::ExampleGroup
    module RSpec
rescue LoadError
  STDERR.puts "Exception occured: #{e.to_s}"
Exception occured: uninitialized constant Sauce::RSpec::Spec
  exit 1
bootstraponline commented 9 years ago

Adding if defined?(Spec::Example::ExampleGroup) made it crash in a different way.

<top (required)>': undefined methodwebdriver_method=' for Sauce:Module (NoMethodError)

The gem works if bundle exec is used. Pretty frustrating to have this crash the tests on startup with no backtrace.

bootstraponline commented 9 years ago

In RSpec 3 the example group class is RSpec::Core::ExampleGroup so I'm not sure how this code works when the class name is wrong.

bootstraponline commented 9 years ago

ExampleGroupFactory (referenced in rspec_one_support.rb) is an ancient relic from 2011 era RSpec. I think old RSpec support needs to either be removed or updated to not conflict with modern RSpec.

bootstraponline commented 9 years ago

I confirm that #339 fixes the uninitialized constant issue for me. The webdriver_method error was an unrelated problem in my Gemfile.