Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RSpec: undefined method `infer_spec_type_from_file_location!' for #<RSpec::Core::Configuration:0x00000103bc6020> (NoMethodError)

I am writing some tests for my Rails controller, and I am using RSpec 3.0.2

After getting this error, when I try to simulate a POST call to a route:

NoMethodError:
   undefined method `post' for #   <RSpec::ExampleGroups::WebApplicationsController::ProcessPayment:0x00000106214ce0>

I then read this SO thread and I added the following line to my spec_helper.rb

RSpec.configuration.infer_spec_type_from_file_location!

Which gives me the following error when I run rspec spec:

code/fsa/spec/spec_helper.rb:4:in `<top (required)>': undefined method `infer_spec_type_from_file_location!' for #<RSpec::Core::Configuration:0x0000010420e040> (NoMethodError)

I am not really sure what is going on.

like image 556
Thalatta Avatar asked Jul 21 '14 20:07

Thalatta


1 Answers

This was happening due to the fact that I was using gem 'rspec' instead of gem rspec-rails

like image 179
Thalatta Avatar answered Nov 15 '22 09:11

Thalatta