Fix RSpec/DescribedClass
cop (#29472)
This commit is contained in:
parent
c09b8a7164
commit
6262ceeb70
12 changed files with 29 additions and 29 deletions
|
@ -678,7 +678,7 @@ RSpec.describe Account do
|
|||
end
|
||||
|
||||
describe 'MENTION_RE' do
|
||||
subject { Account::MENTION_RE }
|
||||
subject { described_class::MENTION_RE }
|
||||
|
||||
it 'matches usernames in the middle of a sentence' do
|
||||
expect(subject.match('Hello to @alice from me')[1]).to eq 'alice'
|
||||
|
|
|
@ -30,7 +30,7 @@ RSpec.describe Form::Import do
|
|||
|
||||
it 'has errors' do
|
||||
subject.validate
|
||||
expect(subject.errors[:data]).to include(I18n.t('imports.errors.over_rows_processing_limit', count: Form::Import::ROWS_PROCESSING_LIMIT))
|
||||
expect(subject.errors[:data]).to include(I18n.t('imports.errors.over_rows_processing_limit', count: described_class::ROWS_PROCESSING_LIMIT))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ describe PrivacyPolicy do
|
|||
it 'has the privacy text' do
|
||||
policy = described_class.current
|
||||
|
||||
expect(policy.text).to eq(PrivacyPolicy::DEFAULT_PRIVACY_POLICY)
|
||||
expect(policy.text).to eq(described_class::DEFAULT_PRIVACY_POLICY)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ RSpec.describe Tag do
|
|||
end
|
||||
|
||||
describe 'HASHTAG_RE' do
|
||||
subject { Tag::HASHTAG_RE }
|
||||
subject { described_class::HASHTAG_RE }
|
||||
|
||||
it 'does not match URLs with anchors with non-hashtag characters' do
|
||||
expect(subject.match('Check this out https://medium.com/@alice/some-article#.abcdef123')).to be_nil
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe UserRole do
|
|||
describe '#can?' do
|
||||
context 'with a single flag' do
|
||||
it 'returns true if any of them are present' do
|
||||
subject.permissions = UserRole::FLAGS[:manage_reports]
|
||||
subject.permissions = described_class::FLAGS[:manage_reports]
|
||||
expect(subject.can?(:manage_reports)).to be true
|
||||
end
|
||||
|
||||
|
@ -19,7 +19,7 @@ RSpec.describe UserRole do
|
|||
|
||||
context 'with multiple flags' do
|
||||
it 'returns true if any of them are present' do
|
||||
subject.permissions = UserRole::FLAGS[:manage_users]
|
||||
subject.permissions = described_class::FLAGS[:manage_users]
|
||||
expect(subject.can?(:manage_reports, :manage_users)).to be true
|
||||
end
|
||||
|
||||
|
@ -51,7 +51,7 @@ RSpec.describe UserRole do
|
|||
|
||||
describe '#permissions_as_keys' do
|
||||
before do
|
||||
subject.permissions = UserRole::FLAGS[:invite_users] | UserRole::FLAGS[:view_dashboard] | UserRole::FLAGS[:manage_reports]
|
||||
subject.permissions = described_class::FLAGS[:invite_users] | described_class::FLAGS[:view_dashboard] | described_class::FLAGS[:manage_reports]
|
||||
end
|
||||
|
||||
it 'returns an array' do
|
||||
|
@ -70,7 +70,7 @@ RSpec.describe UserRole do
|
|||
let(:input) { %w(manage_users) }
|
||||
|
||||
it 'sets permission flags' do
|
||||
expect(subject.permissions).to eq UserRole::FLAGS[:manage_users]
|
||||
expect(subject.permissions).to eq described_class::FLAGS[:manage_users]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -78,7 +78,7 @@ RSpec.describe UserRole do
|
|||
let(:input) { %w(manage_users manage_reports) }
|
||||
|
||||
it 'sets permission flags' do
|
||||
expect(subject.permissions).to eq UserRole::FLAGS[:manage_users] | UserRole::FLAGS[:manage_reports]
|
||||
expect(subject.permissions).to eq described_class::FLAGS[:manage_users] | described_class::FLAGS[:manage_reports]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -86,7 +86,7 @@ RSpec.describe UserRole do
|
|||
let(:input) { %w(foo) }
|
||||
|
||||
it 'does not set permission flags' do
|
||||
expect(subject.permissions).to eq UserRole::Flags::NONE
|
||||
expect(subject.permissions).to eq described_class::Flags::NONE
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -96,7 +96,7 @@ RSpec.describe UserRole do
|
|||
subject { described_class.nobody }
|
||||
|
||||
it 'returns none' do
|
||||
expect(subject.computed_permissions).to eq UserRole::Flags::NONE
|
||||
expect(subject.computed_permissions).to eq described_class::Flags::NONE
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -110,11 +110,11 @@ RSpec.describe UserRole do
|
|||
|
||||
context 'when role has the administrator flag' do
|
||||
before do
|
||||
subject.permissions = UserRole::FLAGS[:administrator]
|
||||
subject.permissions = described_class::FLAGS[:administrator]
|
||||
end
|
||||
|
||||
it 'returns all permissions' do
|
||||
expect(subject.computed_permissions).to eq UserRole::Flags::ALL
|
||||
expect(subject.computed_permissions).to eq described_class::Flags::ALL
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -135,7 +135,7 @@ RSpec.describe UserRole do
|
|||
end
|
||||
|
||||
it 'has default permissions' do
|
||||
expect(subject.permissions).to eq UserRole::FLAGS[:invite_users]
|
||||
expect(subject.permissions).to eq described_class::FLAGS[:invite_users]
|
||||
end
|
||||
|
||||
it 'has negative position' do
|
||||
|
@ -155,7 +155,7 @@ RSpec.describe UserRole do
|
|||
end
|
||||
|
||||
it 'has no permissions' do
|
||||
expect(subject.permissions).to eq UserRole::Flags::NONE
|
||||
expect(subject.permissions).to eq described_class::Flags::NONE
|
||||
end
|
||||
|
||||
it 'has negative position' do
|
||||
|
|
|
@ -24,7 +24,7 @@ RSpec.describe UserSettings do
|
|||
|
||||
context 'when setting was not defined' do
|
||||
it 'raises error' do
|
||||
expect { subject[:foo] }.to raise_error UserSettings::KeyError
|
||||
expect { subject[:foo] }.to raise_error described_class::KeyError
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -93,7 +93,7 @@ RSpec.describe UserSettings do
|
|||
describe '.definition_for' do
|
||||
context 'when key is defined' do
|
||||
it 'returns a setting' do
|
||||
expect(described_class.definition_for(:always_send_emails)).to be_a UserSettings::Setting
|
||||
expect(described_class.definition_for(:always_send_emails)).to be_a described_class::Setting
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue