summaryrefslogtreecommitdiff
path: root/spec/features/security/profile_access_spec.rb
blob: bcabc2d53ac9d200cb0d0b1ba8f92579cd2cbb9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
require 'spec_helper'

describe "Profile access", feature: true  do
  before do
    @u1 = create(:user)
  end

  describe "GET /login" do
    it { expect(new_user_session_path).not_to be_not_found_for :visitor }
  end

  describe "GET /profile/keys" do
    subject { profile_keys_path }

    it { is_expected.to be_allowed_for @u1 }
    it { is_expected.to be_allowed_for :admin }
    it { is_expected.to be_allowed_for :user }
    it { is_expected.to be_denied_for :visitor }
  end

  describe "GET /profile" do
    subject { profile_path }

    it { is_expected.to be_allowed_for @u1 }
    it { is_expected.to be_allowed_for :admin }
    it { is_expected.to be_allowed_for :user }
    it { is_expected.to be_denied_for :visitor }
  end

  describe "GET /profile/account" do
    subject { profile_account_path }

    it { is_expected.to be_allowed_for @u1 }
    it { is_expected.to be_allowed_for :admin }
    it { is_expected.to be_allowed_for :user }
    it { is_expected.to be_denied_for :visitor }
  end

  describe "GET /profile/preferences" do
    subject { profile_preferences_path }

    it { is_expected.to be_allowed_for @u1 }
    it { is_expected.to be_allowed_for :admin }
    it { is_expected.to be_allowed_for :user }
    it { is_expected.to be_denied_for :visitor }
  end

  describe "GET /profile/audit_log" do
    subject { audit_log_profile_path }

    it { is_expected.to be_allowed_for @u1 }
    it { is_expected.to be_allowed_for :admin }
    it { is_expected.to be_allowed_for :user }
    it { is_expected.to be_denied_for :visitor }
  end

  describe "GET /profile/notifications" do
    subject { profile_notifications_path }

    it { is_expected.to be_allowed_for @u1 }
    it { is_expected.to be_allowed_for :admin }
    it { is_expected.to be_allowed_for :user }
    it { is_expected.to be_denied_for :visitor }
  end
end