Sha256: ac2c925aec60b9e5e54daf06d997fa55bf5f6d5001d98fda460f45c40e41d6cb

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

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

describe Admin::SitesController do
  dataset :sites_site_users_and_site_pages

  { :get => [:index, :new, :edit, :remove],
    :post => [:create],
    :put => [:update],
    :delete => [:destroy] }.each do |method, actions|
    actions.each do |action|
      it "should require login to access the #{action} action" do
        logout
        lambda { send(method, action, :id => site_id(:site_a)).should require_login }
      end

      it "should allow you to access to #{action} action if you are a site_admin" do
        lambda { 
          send(method, action, :id => site_id(:site_a)) 
        }.should restrict_access(:allow => users(:admina),
                                 :url => '/admin/page')
      end
      
      it "should deny you access to #{action} action if you are not a site_admin" do
        lambda { 
          send(method, action, :id => site_id(:site_a)) 
        }.should restrict_access(:deny => [users(:developera), users(:developerb), users(:usera), users(:userb)],
                                 :url => '/admin/page')
      end
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
radiant-vhost-extension-2.3.1 spec/controllers/admin/sites_controller_spec.rb
radiant-vhost-extension-2.3.0 spec/controllers/admin/sites_controller_spec.rb
radiant-vhost-extension-2.2.0 spec/controllers/admin/sites_controller_spec.rb
radiant-vhost-extension-2.1.0 spec/controllers/admin/sites_controller_spec.rb