summaryrefslogtreecommitdiff
path: root/spec/policies/namespace_policy_spec.rb
blob: e52ff02e5f042508e6bd3e53d69091070d7513aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'spec_helper'

describe NamespacePolicy do
  let(:current_user) { create(:user) }
  let(:namespace) { current_user.namespace }

  subject { described_class.new(current_user, namespace) }

  context "create projects" do
    context "user namespace" do
      it { is_expected.to be_allowed(:create_projects) }
    end

    context "user who has exceeded project limit" do
      let(:current_user) { create(:user, projects_limit: 0) }

      it { is_expected.not_to be_allowed(:create_projects) }
    end
  end
end