profile_access_spec.rb 1.01 KB
Newer Older
gitlabhq's avatar
gitlabhq committed
1 2 3 4
require 'spec_helper'

describe "Users Security" do
  describe "Project" do
Nihad Abbasov's avatar
Nihad Abbasov committed
5
    before do
gitlabhq's avatar
gitlabhq committed
6 7 8
      @u1 = Factory :user
    end

Nihad Abbasov's avatar
Nihad Abbasov committed
9
    describe "GET /login" do
gitlabhq's avatar
gitlabhq committed
10
      it { new_user_session_path.should_not be_404_for :visitor }
gitlabhq's avatar
gitlabhq committed
11 12
    end

Nihad Abbasov's avatar
Nihad Abbasov committed
13
    describe "GET /keys" do
gitlabhq's avatar
gitlabhq committed
14 15 16 17 18 19
      it { keys_path.should be_allowed_for @u1 }
      it { keys_path.should be_allowed_for :admin }
      it { keys_path.should be_allowed_for :user }
      it { keys_path.should be_denied_for :visitor }
    end

Nihad Abbasov's avatar
Nihad Abbasov committed
20
    describe "GET /profile" do
gitlabhq's avatar
gitlabhq committed
21 22 23 24 25 26
      it { profile_path.should be_allowed_for @u1 }
      it { profile_path.should be_allowed_for :admin }
      it { profile_path.should be_allowed_for :user }
      it { profile_path.should be_denied_for :visitor }
    end

Nihad Abbasov's avatar
Nihad Abbasov committed
27
    describe "GET /profile/password" do
gitlabhq's avatar
gitlabhq committed
28 29 30 31 32 33 34
      it { profile_password_path.should be_allowed_for @u1 }
      it { profile_password_path.should be_allowed_for :admin }
      it { profile_password_path.should be_allowed_for :user }
      it { profile_password_path.should be_denied_for :visitor }
    end
  end
end