Sha256: 6a033612c968da8fb260a3f4d26ce81011975977889e2ff620d556cbefa0cafa

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sunrise-cms-0.4.0 spec/controllers/sunrise/manager_controller_spec.rb
sunrise-cms-0.3.3 spec/controllers/sunrise/manager_controller_spec.rb
sunrise-cms-0.3.2 spec/controllers/sunrise/manager_controller_spec.rb
sunrise-cms-0.3.1 spec/controllers/sunrise/manager_controller_spec.rb
sunrise-cms-0.3.0 spec/controllers/sunrise/manager_controller_spec.rb