debian-mirror-gitlab/spec/policies/concerns/crud_policy_helpers_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.2 KiB
Ruby
Raw Permalink Normal View History

2020-10-24 23:57:45 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe CrudPolicyHelpers do
let(:policy_test_class) do
Class.new do
include CrudPolicyHelpers
end
end
let(:feature_name) { :foo }
before do
stub_const('PolicyTestClass', policy_test_class)
end
describe '.create_read_update_admin_destroy' do
it 'returns an array of the appropriate abilites given a feature name' do
2022-11-25 23:54:43 +05:30
expect(PolicyTestClass.create_read_update_admin_destroy(feature_name)).to eq(
[
:read_foo,
:create_foo,
:update_foo,
:admin_foo,
:destroy_foo
])
2020-10-24 23:57:45 +05:30
end
end
describe '.create_update_admin_destroy' do
it 'returns an array of the appropriate abilites given a feature name' do
2022-11-25 23:54:43 +05:30
expect(PolicyTestClass.create_update_admin_destroy(feature_name)).to eq(
[
:create_foo,
:update_foo,
:admin_foo,
:destroy_foo
])
2020-10-24 23:57:45 +05:30
end
end
describe '.create_update_admin' do
it 'returns an array of the appropriate abilites given a feature name' do
2022-11-25 23:54:43 +05:30
expect(PolicyTestClass.create_update_admin(feature_name)).to eq(
[
:create_foo,
:update_foo,
:admin_foo
])
2020-10-24 23:57:45 +05:30
end
end
end