summaryrefslogtreecommitdiff
path: root/spec/features/security/profile_access_spec.rb
blob: 2512a9c0e3d414a36f920ab780b22ebaa63a091d (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_404_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/design" do
    subject { design_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/history" do
    subject { history_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