profile_access_spec.rb 961 Bytes
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
Robert Speicher's avatar
Robert Speicher committed
14 15 16 17 18 19
      subject { keys_path }

      it { should be_allowed_for @u1 }
      it { should be_allowed_for :admin }
      it { should be_allowed_for :user }
      it { should be_denied_for :visitor }
gitlabhq's avatar
gitlabhq committed
20 21
    end

Nihad Abbasov's avatar
Nihad Abbasov committed
22
    describe "GET /profile" do
Robert Speicher's avatar
Robert Speicher committed
23 24 25 26 27 28
      subject { profile_path }

      it { should be_allowed_for @u1 }
      it { should be_allowed_for :admin }
      it { should be_allowed_for :user }
      it { should be_denied_for :visitor }
gitlabhq's avatar
gitlabhq committed
29 30
    end

Nihad Abbasov's avatar
Nihad Abbasov committed
31
    describe "GET /profile/password" do
Robert Speicher's avatar
Robert Speicher committed
32 33 34 35 36 37
      subject { profile_password_path }

      it { should be_allowed_for @u1 }
      it { should be_allowed_for :admin }
      it { should be_allowed_for :user }
      it { should be_denied_for :visitor }
gitlabhq's avatar
gitlabhq committed
38 39 40
    end
  end
end