Rspec路由测试没有通过

时间:2015-06-18 12:06:05

标签: ruby-on-rails ruby rspec

以下的rspec测试没有通过,我不确定我做错了什么。它在浏览器中路由很好,但测试没有通过。

require 'spec_helper'

describe QueueVideosController do
  describe "GET show" do
    context "with authenticated users" do
      it "routes /queue to the QueueVideos controller" do
        expect(get("/queue")).to route_to("queue_videos#show")
      end
    end
  end
end

来自我的控制器:

class QueueVideosController < ApplicationController
 def show
 end
end

从我的路线档案:

 get '/queue' => 'queue_videos#show'

1 个答案:

答案 0 :(得分:1)

尝试使用其他语法:

expect(get: "/queue").to route_to(
  controller: "queue_videos",
  action: "show"
)