* Rename banned and comment_banned roles * Add data update script to rename roles containing 'ban' * Add named error for Suspended users * Update unidiomatic method names * Rename misc banned to suspended * Apply suggestions from code review Co-authored-by: Michael Kohl <me@citizen428.net> * Add unit tests for suspended methods This commit also adds TODO comments for removing banned and comment_banned from the codebase after data update scripts have successfully run on all of our Forems. Co-authored-by: Michael Kohl <me@citizen428.net>
18 lines
724 B
Ruby
18 lines
724 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe Role, type: :model do
|
|
it { is_expected.to belong_to(:resource).optional }
|
|
it { is_expected.to validate_inclusion_of(:resource_type).in_array(Rolify.resource_types) }
|
|
it { is_expected.to validate_inclusion_of(:name).in_array(described_class::ROLES) }
|
|
|
|
describe "::ROLES" do
|
|
it "contains the correct values" do
|
|
expected_roles = %w[
|
|
admin chatroom_beta_tester codeland_admin comment_suspended mod_relations_admin podcast_admin
|
|
restricted_liquid_tag single_resource_admin super_admin support_admin suspended tag_moderator tech_admin
|
|
trusted warned workshop_pass
|
|
]
|
|
expect(described_class::ROLES).to eq(expected_roles)
|
|
end
|
|
end
|
|
end
|