Fix RSpec/DescribedClass
cop (#25104)
This commit is contained in:
parent
1e243e2df7
commit
c42591356d
66 changed files with 347 additions and 414 deletions
|
@ -17,7 +17,7 @@ describe WebfingerResource do
|
|||
resource = 'https://example.com/users/alice/other'
|
||||
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
described_class.new(resource).username
|
||||
end.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
|
@ -32,7 +32,7 @@ describe WebfingerResource do
|
|||
expect(Rails.application.routes).to receive(:recognize_path).with(resource).and_return(recognized).at_least(:once)
|
||||
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
described_class.new(resource).username
|
||||
end.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
|
@ -40,28 +40,28 @@ describe WebfingerResource do
|
|||
resource = 'website for http://example.com/users/alice/other'
|
||||
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
described_class.new(resource).username
|
||||
end.to raise_error(WebfingerResource::InvalidRequest)
|
||||
end
|
||||
|
||||
it 'finds the username in a valid https route' do
|
||||
resource = 'https://example.com/users/alice'
|
||||
|
||||
result = WebfingerResource.new(resource).username
|
||||
result = described_class.new(resource).username
|
||||
expect(result).to eq 'alice'
|
||||
end
|
||||
|
||||
it 'finds the username in a mixed case http route' do
|
||||
resource = 'HTTp://exAMPLe.com/users/alice'
|
||||
|
||||
result = WebfingerResource.new(resource).username
|
||||
result = described_class.new(resource).username
|
||||
expect(result).to eq 'alice'
|
||||
end
|
||||
|
||||
it 'finds the username in a valid http route' do
|
||||
resource = 'http://example.com/users/alice'
|
||||
|
||||
result = WebfingerResource.new(resource).username
|
||||
result = described_class.new(resource).username
|
||||
expect(result).to eq 'alice'
|
||||
end
|
||||
end
|
||||
|
@ -71,7 +71,7 @@ describe WebfingerResource do
|
|||
resource = 'user@remote-host.com'
|
||||
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
described_class.new(resource).username
|
||||
end.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
|
@ -79,7 +79,7 @@ describe WebfingerResource do
|
|||
Rails.configuration.x.local_domain = 'example.com'
|
||||
resource = 'alice@example.com'
|
||||
|
||||
result = WebfingerResource.new(resource).username
|
||||
result = described_class.new(resource).username
|
||||
expect(result).to eq 'alice'
|
||||
end
|
||||
|
||||
|
@ -87,7 +87,7 @@ describe WebfingerResource do
|
|||
Rails.configuration.x.web_domain = 'example.com'
|
||||
resource = 'alice@example.com'
|
||||
|
||||
result = WebfingerResource.new(resource).username
|
||||
result = described_class.new(resource).username
|
||||
expect(result).to eq 'alice'
|
||||
end
|
||||
end
|
||||
|
@ -97,7 +97,7 @@ describe WebfingerResource do
|
|||
resource = 'acct:user@remote-host.com'
|
||||
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
described_class.new(resource).username
|
||||
end.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
|
@ -105,7 +105,7 @@ describe WebfingerResource do
|
|||
resource = 'acct:user@remote-host@remote-hostess.remote.local@remote'
|
||||
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
described_class.new(resource).username
|
||||
end.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
|
@ -113,7 +113,7 @@ describe WebfingerResource do
|
|||
Rails.configuration.x.local_domain = 'example.com'
|
||||
resource = 'acct:alice@example.com'
|
||||
|
||||
result = WebfingerResource.new(resource).username
|
||||
result = described_class.new(resource).username
|
||||
expect(result).to eq 'alice'
|
||||
end
|
||||
|
||||
|
@ -121,7 +121,7 @@ describe WebfingerResource do
|
|||
Rails.configuration.x.web_domain = 'example.com'
|
||||
resource = 'acct:alice@example.com'
|
||||
|
||||
result = WebfingerResource.new(resource).username
|
||||
result = described_class.new(resource).username
|
||||
expect(result).to eq 'alice'
|
||||
end
|
||||
end
|
||||
|
@ -131,7 +131,7 @@ describe WebfingerResource do
|
|||
resource = 'df/:dfkj'
|
||||
|
||||
expect do
|
||||
WebfingerResource.new(resource).username
|
||||
described_class.new(resource).username
|
||||
end.to raise_error(WebfingerResource::InvalidRequest)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue