Sha256: 047c2b566799a1bc2e0c72e3e8c21b14377c9677669d9c0e44283792dcc08c35

Contents?: true

Size: 1.6 KB

Versions: 7

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'

describe "Sunrise Manager Index" do
  subject { page }
  before(:all) do 
    @admin = FactoryGirl.create(:admin_user)
    
    @root = FactoryGirl.create(:structure_main)
    @page = FactoryGirl.create(:structure_page, :parent => @root)
  end

  context "admin" do
    before(:each) { login_as @admin }
    
    describe "GET /manage" do
      it "should respond successfully" do
        visit root_path
      end
    end
    
    describe "GET /manage/typo" do
      it "should raise NotFound" do
        lambda {
          visit '/manage/whatever'
        }.should raise_error ActionController::RoutingError
      end
    end

    describe "GET /manage/structures" do
      before(:each) do 
        visit index_path(:model_name => "structures")
      end
      
      it "should show page title" do
        should have_content( @page.title )
      end
    end
    
    describe "GET /manage/users" do
      before(:each) do
        Sunrise::Config.scoped_views = true 
        visit index_path(:model_name => "users")
      end
      
      it "should render inherit user templace" do
        should have_content( "UserTestSection" )
      end
    end
    
    describe "GET /manage/pages" do      
      it "should render 404 page" do
        lambda {
          visit index_path(:model_name => "pages")
        }.should raise_error AbstractController::ActionNotFound
      end
    end
  end
  
  describe "anonymous user" do
    before(:each) do
      visit index_path(:model_name => "structures")
    end
    
    it "should redirect to login page" do
      should have_content('Sign in')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sunrise-cms-0.4.2 spec/requests/manager/default/index_spec.rb
sunrise-cms-0.4.1 spec/requests/manager/default/index_spec.rb
sunrise-cms-0.4.0 spec/requests/manager/default/index_spec.rb
sunrise-cms-0.3.3 spec/requests/manager/default/index_spec.rb
sunrise-cms-0.3.2 spec/requests/manager/default/index_spec.rb
sunrise-cms-0.3.1 spec/requests/manager/default/index_spec.rb
sunrise-cms-0.3.0 spec/requests/manager/default/index_spec.rb