Sha256: 5c55e4ceff3aea756d25aa9f12ff75e82a3b9493f5e00cc3e7169cc8c98c600e

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe Admin::PageFactoriesController do
  dataset :users, :pages

  class ParamPageFactory < PageFactory::Base
  end

  before do
    login_as :admin
  end

  describe "index" do
    it "should expose page instance" do
      get :index, :page => page_id(:home)
      assigns(:page).should eql(pages(:home))
    end

    it "should expose factory list" do
      get :index, :page => page_id(:home)
      assigns(:factories).should include(PageFactory::Base)
    end

  end

  describe ".factory_link" do
    before :all do
      Admin::PageFactoriesController.send :public, :factory_link
    end

    it "should give a link for a new page" do
      controller.instance_variable_set :@page, nil
      controller.factory_link.should eql(new_admin_page_path)
    end

    it "should give a link for an existing page" do
      controller.instance_variable_set :@page, pages(:home)
      controller.factory_link.should eql(new_admin_page_child_path(pages(:home)))
    end

    it "should create a link with a page_factory param" do
      controller.instance_variable_set :@page, pages(:home)
      controller.factory_link(ParamPageFactory).should eql(new_admin_page_child_path(pages(:home), :factory => 'ParamPageFactory'))
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-page_factory-extension-1.0.1 spec/controllers/admin/page_factories_controller_spec.rb
radiant-page_factory-extension-1.0.0 spec/controllers/admin/page_factories_controller_spec.rb