如何在rails 3.2.6中为精炼页面控制器创建自己的规范 - 在rails更新后找不到路由

时间:2012-07-01 21:26:16

标签: ruby-on-rails rspec rspec-rails rails-routing refinerycms

我最近将基于RefineryCMS的应用程序从Rails 3.2.2升级到3.2.6。

在升级之前,炼油厂页面控制器的以下规范运作良好:

describe Refinery::PagesController do
render_views

context "Should check the ability to see a page" do
  before(:each) do 
    @live_page = FactoryGirl.create(:live_refinery_page)
    @restricted_page = FactoryGirl.create(:restricted_refinery_page) 
    @draft_page = FactoryGirl.create(:draft_refinery_page)
    @error_page = FactoryGirl.create(:error_refinery_page)
  end

context "for a not logged in user" do
  it "should see live pages" do
    get :show, :path => @live_page.slug, :format => "html"
    response.should be_success
    response.should render_template "refinery/pages/show"
  end
  ...

应匹配的路线定义如下:

marketable_page GET     /*path(.:format)                             refinery/pages#show

现在,问题是我在所有测试中都收到了这样的错误:

1) Refinery::PagesController Should check the ability to see a page for a not logged in user should see live pages
 Failure/Error: get :show, :path => @live_page.slug, :format => "html"
 ActionController::RoutingError:
   No route matches {:path=>"live-page-1", :format=>"html", :controller=>"refinery/pages", :action=>"show"}
 # ./config/initializers/refinery/monkey_patches.rb:13:in `around_generate'
 # ./spec/controllers/refinery/pages_controller_spec.rb:17:in `block (4 levels) in <top (required)>

如何在规格中识别路线?也许它必须做路线全球化?

任何提示?

0 个答案:

没有答案