tre*_*ek1 3 ruby rspec ruby-on-rails
我是Rspec的新手,我正在尝试在我的应用程序中测试一条路线.我已经安装了Rspec并且已经包含了路由文件spec/routing/routes_spec.rb.
我的规格如下:
require "spec_helper"
describe "Routes" do
it "routes get index" do
expect(:get => "simulations").to route_to(
:controller => "simulations",
:action => "index"
)
end
end
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Routes routes get index
Failure/Error: expect(:get => "simulations").to route_to(
NoMethodError:
undefined method `route_to' for #<RSpec::ExampleGroups::Routes:0x007fc32d2f70b8 @__memoized=nil>
# ./spec/routing/routes_spec.rb:6:in `block (2 levels) in <top (required)>'
Run Code Online (Sandbox Code Playgroud)
关于为什么route_to不明确的任何想法?我已经确认路线确实有效.
| 归档时间: |
|
| 查看次数: |
1877 次 |
| 最近记录: |