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.
This was happening due to the fact that I was using gem 'rspec'
instead of gem rspec-rails
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With