Sha256: 60f94ed726895ee74a308654761243132c697ced2cb0ea2da9ae818104704fa6

Contents?: true

Size: 753 Bytes

Versions: 19

Compression:

Stored size: 753 Bytes

Contents

shared_examples_for 'deny' do |user_role|
  it "deny index for #{user_role}" do
    user = FactoryGirl.create("#{user_role}_user")
    login_as user, scope: :user

    gaku_get :index
    response.should redirect_to '/'
    flash[:alert].should eq 'You are not authorized to access this page.'
  end
end

shared_examples_for 'deny except' do |except_role|
  Gaku::Role.destroy_all

  %w(principal vice_principal).each do |role|
    unless role == except_role
      it "deny index for #{role}" do
        user = FactoryGirl.create("#{role}_user")
        login_as user, scope: :user

        gaku_get :index
        response.should redirect_to '/'
        flash[:alert].should eq 'You are not authorized to access this page.'
      end
    end
  end
end

Version data entries

19 entries across 10 versions & 1 rubygems

Version Path
gaku-0.2.4 frontend/spec/support/controllers/shared_examples/deny.rb
gaku-0.2.4 admin/spec/support/controllers/shared_examples/deny.rb
gaku-0.2.3 frontend/spec/support/controllers/shared_examples/deny.rb
gaku-0.2.3 admin/spec/support/controllers/shared_examples/deny.rb
gaku-0.2.2 admin/spec/support/controllers/shared_examples/deny.rb
gaku-0.2.2 frontend/spec/support/controllers/shared_examples/deny.rb
gaku-0.2.1 frontend/spec/support/controllers/shared_examples/deny.rb
gaku-0.2.1 admin/spec/support/controllers/shared_examples/deny.rb
gaku-0.2.0 admin/spec/support/controllers/shared_examples/deny.rb
gaku-0.2.0 frontend/spec/support/controllers/shared_examples/deny.rb
gaku-0.1.1 admin/spec/support/controllers/shared_examples/deny.rb
gaku-0.1.1 frontend/spec/support/controllers/shared_examples/deny.rb
gaku-0.1.1 archive/spec/support/controllers/shared_examples/deny.rb
gaku-0.1.0 frontend/spec/support/controllers/shared_examples/deny.rb
gaku-0.1.0 archive/spec/support/controllers/shared_examples/deny.rb
gaku-0.1.0 admin/spec/support/controllers/shared_examples/deny.rb
gaku-0.0.3 core/spec/support/shared_examples/deny.rb
gaku-0.0.2 core/spec/support/shared_examples/deny.rb
gaku-0.0.1 core/spec/support/shared_examples/deny.rb