我在我的 Ruby on Rails 开发中做 TDD。我的代码如下所示:
require "spec_helper"
describe "Schedule routing" do
it "by default should redirect /schedule to 'schedule/dateview'" do
visit("/schedule")
current_path.should == "/schedule/dateview"
end
end
这是检查路由的更简洁的方法吗?
编辑:添加我的 routes.rb 以获得更多上下文:
get "schedule/dateview", to: "events#dateview"
get "schedule/courseview", to: "events#courseview"
match "/schedule" => redirect("/schedule/dateview"), via: :get