I have a fresh rails-composer omniauth application. When running tests with rspec it gives this error:
$ rspec
/home/grzegorz/programing/integra/spec/support/helpers.rb:5:in `block in <top (required)>': uninitialized constant Omniauth (NameError)
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/lib/rspec/core.rb:97:in `configure'
from /home/grzegorz/programing/integra/spec/support/helpers.rb:4:in `<top (required)>'
from /home/grzegorz/programing/integra/spec/rails_helper.rb:23:in `block in <top (required)>'
from /home/grzegorz/programing/integra/spec/rails_helper.rb:23:in `each'
from /home/grzegorz/programing/integra/spec/rails_helper.rb:23:in `<top (required)>'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1280:in `require'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1280:in `block in requires='
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1280:in `each'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1280:in `requires='
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/lib/rspec/core/configuration_options.rb:109:in `block in process_options_into'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/lib/rspec/core/configuration_options.rb:108:in `each'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/lib/rspec/core/configuration_options.rb:108:in `process_options_into'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/lib/rspec/core/configuration_options.rb:21:in `configure'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:101:in `setup'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:88:in `run'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:73:in `run'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:41:in `invoke'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/gems/rspec-core-3.3.1/exe/rspec:4:in `<top (required)>'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/bin/rspec:23:in `load'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/bin/rspec:23:in `<main>'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/bin/ruby_executable_hooks:15:in `eval'
from /home/grzegorz/.rvm/gems/ruby-2.2.2@integra/bin/ruby_executable_hooks:15:in `<main>'
It gives me much trouble to debbug.
EDIT. My gem file has those:
gem 'omniauth'
gem 'omniauth-facebook'
It is a fresh app generated with rails-composer, no custom code.
I was having the same error, and had to include the line
in the beginning of the specs/spec_helper.rb file to get it working.
You should add
require_relative 'helpers/omniauth'
at the beginning ofspec/support/helpers.rb
- works for me.I believe OmniAuth class is with capital "A". If it's not that, check your GemFile if you added the gem properly.
omniauth gem works with other gems i.e if you want to use facebook,twitter you need to add other gems too.