1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/spec/policies/federal_subject_policy_spec.rb
2019-09-01 16:28:52 +05:00

28 lines
863 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
RSpec.describe FederalSubjectPolicy do
subject { described_class.new current_account, record }
let :resolved_scope do
described_class::Scope.new(current_account, FederalSubject.all).resolve
end
let!(:record) { create :federal_subject }
let!(:other_record) { create :federal_subject }
before { create_list :federal_subject, 3 }
for_account_types nil, :usual, :superuser do
it { is_expected.to permit_actions %i[index show] }
it { is_expected.to forbid_new_and_create_actions }
it { is_expected.to forbid_edit_and_update_actions }
it { is_expected.to forbid_action :destroy }
specify { expect(resolved_scope).to eq FederalSubject.all }
specify { expect(resolved_scope).to include record }
specify { expect(resolved_scope).to include other_record }
end
end