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

29 lines
871 B
Ruby
Raw Normal View History

2019-01-31 17:38:06 -05:00
# frozen_string_literal: true
require 'rails_helper'
2019-06-23 11:54:41 -04:00
RSpec.describe FederalSubjectPolicy do
2019-01-31 17:38:06 -05:00
subject { described_class.new current_account, record }
let :resolved_scope do
2019-06-23 11:54:41 -04:00
described_class::Scope.new(current_account, FederalSubject.all).resolve
2019-01-31 17:38:06 -05:00
end
2019-06-23 11:59:44 -04:00
let!(:record) { create :federal_subject }
let!(:other_record) { create :federal_subject }
2019-01-31 17:38:06 -05:00
2019-06-23 11:59:44 -04:00
before { create_list :federal_subject, 3 }
2019-01-31 17:38:06 -05:00
for_account_types nil, :guest, :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 }
2019-06-23 11:54:41 -04:00
specify { expect(resolved_scope).to eq FederalSubject.all }
2019-01-31 17:38:06 -05:00
specify { expect(resolved_scope).to include record }
specify { expect(resolved_scope).to include other_record }
end
end