Sha256: 4df1c19e2e7bfdd38409a91881f24eddc6d15b7bec031ff222689f9a99517386

Contents?: true

Size: 1.27 KB

Versions: 8

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Sunrise::ManagerController do
  #render_views
  
  describe "#current_ability" do
    before(:each) { @ability = controller.send(:current_ability) }
    
    it "should have namespace sunrise" do
      @ability.context.should == :sunrise
    end
    
    it "should be a guest user" do
      @ability.user.should be_new_record
    end
  end
  
  describe "admin" do
    login_admin
    
    context "index" do
      before(:all) do
        @root = FactoryGirl.create(:structure_main)
        @page = FactoryGirl.create(:structure_page, :parent => @root)
      end
      
      it "should respond successfully" do
        get :index, :model_name => "structures"
        
        assigns(:records).should include(@root)
        assigns(:records).should_not include(@page)
        
        response.should render_template('index')
      end
      
      it "should render 404 page" do
        lambda {
          get :index, :model_name => "wrong"
        }.should raise_error ActionController::RoutingError
      end

      it "should not destroy root structure" do
        @root.kind.should == ::StructureType.main.id
        
        controller.should_not_receive(:destroy)
        delete :destroy, :model_name => "structures", :id => @root.id
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sunrise-cms-0.5.0 spec/controllers/sunrise/manager_controller_spec.rb
sunrise-cms-0.5.0.rc5 spec/controllers/sunrise/manager_controller_spec.rb
sunrise-cms-0.5.0.rc4 spec/controllers/sunrise/manager_controller_spec.rb
sunrise-cms-0.5.0.rc3 spec/controllers/sunrise/manager_controller_spec.rb
sunrise-cms-0.5.0.rc2 spec/controllers/sunrise/manager_controller_spec.rb
sunrise-cms-0.5.0.rc1 spec/controllers/sunrise/manager_controller_spec.rb
sunrise-cms-0.4.2 spec/controllers/sunrise/manager_controller_spec.rb
sunrise-cms-0.4.1 spec/controllers/sunrise/manager_controller_spec.rb