RSpec:未定义的方法`infer_spec_type_from_file_location!' for#<RSpec :: Core :: Configuration:0x00000103bc6020>(NoMethodError)

Tha*_*tta 5 controller rspec ruby-on-rails ruby-on-rails-4

我正在为我的Rails控制器编写一些测试,我正在使用RSpec 3.0.2

收到此错误后,当我尝试模拟POST对路由的调用时:

NoMethodError:
   undefined method `post' for #   <RSpec::ExampleGroups::WebApplicationsController::ProcessPayment:0x00000106214ce0>
Run Code Online (Sandbox Code Playgroud)

然后我读了他的SO线程,我在下面添加了以下代码spec_helper.rb

RSpec.configuration.infer_spec_type_from_file_location!
Run Code Online (Sandbox Code Playgroud)

我运行时出现以下错误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)
Run Code Online (Sandbox Code Playgroud)

我不确定发生了什么事.

Tha*_*tta 5

这是因为我使用的是gem 'rspec'代替gem rspec-rails