rails/rails-controller-testing

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

Closed this issue · 1 comments

 Failure/Error: get :index
 
 NoMethodError:
   undefined method `get' for #<RSpec::ExampleGroups::AbcController:0x007f9d215f2d80>
   Did you mean?  gets
                  gem

this can happen under the following conditions:

  1. your spec does not have type: :controller (or :type => :controller) OR (your spec is not in the controllers folder AND you have set config.infer_spec_type_from_file_location!) … see this SO post

  2. you have written a spec using the old-style require 'spec_helper' instead of using the newer require 'rails_helper'. You will note that rails_helper now includes spec_helper (to generate both see the Rspec installation steps)