Skip to content

Commit ff9b968

Browse files
committed
Fixed RSpec/DescribedClass.
1 parent a117c5b commit ff9b968

File tree

4 files changed

+17
-26
lines changed

4 files changed

+17
-26
lines changed

.rubocop_todo.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2025-10-16 14:00:36 UTC using RuboCop version 1.68.0.
3+
# on 2025-10-16 14:15:33 UTC using RuboCop version 1.68.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -11,16 +11,6 @@ RSpec/AnyInstance:
1111
Exclude:
1212
- 'spec/strava/api/client_spec.rb'
1313

14-
# Offense count: 13
15-
# This cop supports unsafe autocorrection (--autocorrect-all).
16-
# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
17-
# SupportedStyles: described_class, explicit
18-
RSpec/DescribedClass:
19-
Exclude:
20-
- 'spec/strava/models/athlete_spec.rb'
21-
- 'spec/strava/oauth/client_spec.rb'
22-
- 'spec/strava/webhooks/client_spec.rb'
23-
2414
# Offense count: 5
2515
# Configuration parameters: AllowedGroups.
2616
RSpec/NestedGroups:

spec/strava/models/athlete_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
RSpec.describe Strava::Models::Athlete do
66
let(:fixtures) { 'spec/fixtures/strava/models' }
77
let(:json) { JSON.parse(File.read("#{fixtures}/athlete.json")) }
8-
let(:activity) { Strava::Models::Athlete.new(json) }
8+
let(:activity) { described_class.new(json) }
99

1010
describe 'ride' do
1111
it 'exposes custom properties' do

spec/strava/oauth/client_spec.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
end
99

1010
it_behaves_like 'web client'
11+
1112
context 'with defaults' do
12-
let(:client) { Strava::OAuth::Client.new }
13+
let(:client) { described_class.new }
1314

1415
describe '#initialize' do
1516
it 'sets endpoint' do
@@ -32,8 +33,8 @@
3233
context 'with custom settings' do
3334
describe '#initialize' do
3435
Strava::OAuth::Config::ATTRIBUTES.each do |key|
35-
context key do
36-
let(:client) { Strava::OAuth::Client.new(key => 'custom') }
36+
context key.to_s do
37+
let(:client) { described_class.new(key => 'custom') }
3738

3839
it "sets #{key}" do
3940
expect(client.send(key)).not_to eq Strava::OAuth::Config.send(key)
@@ -46,14 +47,14 @@
4647

4748
context 'with global config' do
4849
after do
49-
Strava::OAuth::Client.config.reset
50+
described_class.config.reset
5051
end
5152

52-
let(:client) { Strava::OAuth::Client.new }
53+
let(:client) { described_class.new }
5354

5455
context 'with client id and secret' do
5556
before do
56-
Strava::OAuth::Client.configure do |config|
57+
described_class.configure do |config|
5758
config.client_id = 'custom client id'
5859
config.client_secret = 'custom client secret'
5960
end
@@ -69,7 +70,7 @@
6970
end
7071

7172
context 'with a client id and secret' do
72-
let(:client) { Strava::OAuth::Client.new(client_id: '12345', client_secret: 'client-secret') }
73+
let(:client) { described_class.new(client_id: '12345', client_secret: 'client-secret') }
7374

7475
describe '#authorize_url' do
7576
it 'returns url' do

spec/strava/webhooks/client_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
it_behaves_like 'web client'
1111
context 'with defaults' do
12-
let(:client) { Strava::Webhooks::Client.new }
12+
let(:client) { described_class.new }
1313

1414
describe '#initialize' do
1515
it 'sets endpoint' do
@@ -27,8 +27,8 @@
2727
context 'with custom settings' do
2828
describe '#initialize' do
2929
Strava::Webhooks::Config::ATTRIBUTES.each do |key|
30-
context key do
31-
let(:client) { Strava::Webhooks::Client.new(key => 'custom') }
30+
context key.to_s do
31+
let(:client) { described_class.new(key => 'custom') }
3232

3333
it "sets #{key}" do
3434
expect(client.send(key)).not_to eq Strava::Webhooks::Config.send(key)
@@ -41,14 +41,14 @@
4141

4242
context 'with global config' do
4343
after do
44-
Strava::Webhooks::Client.config.reset
44+
described_class.config.reset
4545
end
4646

47-
let(:client) { Strava::Webhooks::Client.new }
47+
let(:client) { described_class.new }
4848

4949
context 'with client id and secret' do
5050
before do
51-
Strava::Webhooks::Client.configure do |config|
51+
described_class.configure do |config|
5252
config.client_id = 'custom client id'
5353
config.client_secret = 'custom client secret'
5454
end
@@ -64,7 +64,7 @@
6464
end
6565

6666
context 'with a client id and secret' do
67-
let(:client) { Strava::Webhooks::Client.new(client_id: ENV.fetch('STRAVA_CLIENT_ID', '24523'), client_secret: ENV.fetch('STRAVA_CLIENT_SECRET', 'client-secret')) }
67+
let(:client) { described_class.new(client_id: ENV.fetch('STRAVA_CLIENT_ID', '24523'), client_secret: ENV.fetch('STRAVA_CLIENT_SECRET', 'client-secret')) }
6868

6969
describe '#push_subscriptions' do
7070
it 'gets an empty set of push subscriptions', vcr: { cassette_name: 'webhooks/no_push_subscriptions' } do

0 commit comments

Comments
 (0)