Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `get' for #<RSpec::ExampleGroups:: #1633

Closed
bibi-da opened this issue Jun 8, 2016 · 5 comments
Closed

undefined method `get' for #<RSpec::ExampleGroups:: #1633

bibi-da opened this issue Jun 8, 2016 · 5 comments

Comments

@bibi-da
Copy link

bibi-da commented Jun 8, 2016

While testing my controllers I came across this issue. I am using rspec-rails-3.4.2, rails-4.2.0 and mongodb. Here is my rails_helper.rb

`ENV['RAILS_ENV'] ||= 'test'

require File.expand_path('../../config/environment', __FILE__)

abort("The Rails environment is running in production mode!") if Rails.env.production?

require 'spec_helper'
require 'rspec/core'
require 'rspec/rails/extensions'
require 'rspec/rails/view_rendering'
require 'rspec/rails/adapters'
require 'rspec/rails/matchers'
require 'rspec/rails/fixture_support'
require 'rspec/rails/example'
require 'rspec/rails/vendor/capybara'
require 'mongoid-rspec'

RSpec.configure do |config|
  config.before(:suite) do
    DatabaseCleaner.orm = "mongoid"
    DatabaseCleaner.strategy = :truncation
  end
  config.before(:each) do
    DatabaseCleaner.start
  end
  config.after(:each) do
    DatabaseCleaner.clean
  end
end
@JonRowe
Copy link
Member

JonRowe commented Jun 8, 2016

Please just require rspec-rails as require 'rspec/rails' it's likely thats the cause of your issues

@bibi-da
Copy link
Author

bibi-da commented Jun 9, 2016

@JonRowe Thanks for the immediate reply. I tried that too. when I require respec-rails it causes another error

Failure/Error: raise ConnectionNotEstablished, "No connection pool for #{klass}" unless pool

@JonRowe JonRowe closed this as completed Jun 9, 2016
@JonRowe
Copy link
Member

JonRowe commented Jun 9, 2016

Yep, this is a misconfiguration issue on your end, you need to ensure mongoid is loaded before rspec-rails so it doesn't try to use ActiveRecord.

@JonRowe
Copy link
Member

JonRowe commented Jun 9, 2016

Make sure you can do RAILS_ENV=test rails console without error before trying RSpec.

@JonRowe
Copy link
Member

JonRowe commented Jun 9, 2016

For us to help any further you'll have to provide backtraces (via https://gist.github.com)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants