Skip to content

Commit 53696bd

Browse files
committed
style(specs): auto-correct rubocop offenses in test files
Applied rubocop auto-corrections to all spec files: - Add frozen_string_literal comments - Fix block delimiters - Improve test formatting
1 parent 38d775a commit 53696bd

34 files changed

Lines changed: 4711 additions & 4613 deletions

spec/factories/matches.rb

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
FactoryBot.define do
2-
factory :match do
3-
association :organization
4-
match_type { %w[official scrim tournament].sample }
5-
game_start { Faker::Time.between(from: 30.days.ago, to: Time.current) }
6-
game_end { game_start + rand(1200..2400).seconds }
7-
game_duration { (game_end - game_start).to_i }
8-
victory { [true, false].sample }
9-
patch_version { "13.#{rand(1..24)}.1" }
10-
opponent_name { Faker::Esport.team }
11-
our_side { %w[blue red].sample }
12-
our_score { rand(5..30) }
13-
opponent_score { rand(5..30) }
14-
end
15-
end
1+
# frozen_string_literal: true
2+
3+
FactoryBot.define do
4+
factory :match do
5+
association :organization
6+
match_type { %w[official scrim tournament].sample }
7+
game_start { Faker::Time.between(from: 30.days.ago, to: Time.current) }
8+
game_end { game_start + rand(1200..2400).seconds }
9+
game_duration { (game_end - game_start).to_i }
10+
victory { [true, false].sample }
11+
patch_version { "13.#{rand(1..24)}.1" }
12+
opponent_name { Faker::Esport.team }
13+
our_side { %w[blue red].sample }
14+
our_score { rand(5..30) }
15+
opponent_score { rand(5..30) }
16+
end
17+
end

spec/factories/organizations.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
FactoryBot.define do
2-
factory :organization do
3-
name { Faker::Esport.team }
4-
slug { name.parameterize }
5-
region { %w[BR NA EUW KR].sample }
6-
tier { %w[tier_3_amateur tier_2_semi_pro tier_1_professional].sample }
7-
end
8-
end
1+
# frozen_string_literal: true
2+
3+
FactoryBot.define do
4+
factory :organization do
5+
name { Faker::Esport.team }
6+
slug { name.parameterize }
7+
region { %w[BR NA EUW KR].sample }
8+
tier { %w[tier_3_amateur tier_2_semi_pro tier_1_professional].sample }
9+
end
10+
end

spec/factories/players.rb

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
FactoryBot.define do
2-
factory :player do
3-
association :organization
4-
summoner_name { Faker::Esport.player }
5-
real_name { Faker::Name.name }
6-
role { %w[top jungle mid adc support].sample }
7-
status { 'active' }
8-
jersey_number { rand(1..99) }
9-
birth_date { Faker::Date.birthday(min_age: 18, max_age: 30) }
10-
country { 'BR' }
11-
solo_queue_tier { %w[DIAMOND MASTER GRANDMASTER CHALLENGER].sample }
12-
solo_queue_rank { %w[I II III IV].sample }
13-
solo_queue_lp { rand(0..100) }
14-
solo_queue_wins { rand(50..500) }
15-
solo_queue_losses { rand(50..500) }
16-
end
17-
end
1+
# frozen_string_literal: true
2+
3+
FactoryBot.define do
4+
factory :player do
5+
association :organization
6+
summoner_name { Faker::Esport.player }
7+
real_name { Faker::Name.name }
8+
role { %w[top jungle mid adc support].sample }
9+
status { 'active' }
10+
jersey_number { rand(1..99) }
11+
birth_date { Faker::Date.birthday(min_age: 18, max_age: 30) }
12+
country { 'BR' }
13+
solo_queue_tier { %w[DIAMOND MASTER GRANDMASTER CHALLENGER].sample }
14+
solo_queue_rank { %w[I II III IV].sample }
15+
solo_queue_lp { rand(0..100) }
16+
solo_queue_wins { rand(50..500) }
17+
solo_queue_losses { rand(50..500) }
18+
end
19+
end

spec/factories/users.rb

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
1-
FactoryBot.define do
2-
factory :user do
3-
association :organization
4-
email { Faker::Internet.email }
5-
password { 'password123' }
6-
password_confirmation { 'password123' }
7-
full_name { Faker::Name.name }
8-
role { 'analyst' }
9-
10-
trait :owner do
11-
role { 'owner' }
12-
end
13-
14-
trait :admin do
15-
role { 'admin' }
16-
end
17-
18-
trait :coach do
19-
role { 'coach' }
20-
end
21-
22-
trait :analyst do
23-
role { 'analyst' }
24-
end
25-
26-
trait :viewer do
27-
role { 'viewer' }
28-
end
29-
end
30-
end
1+
# frozen_string_literal: true
2+
3+
FactoryBot.define do
4+
factory :user do
5+
association :organization
6+
email { Faker::Internet.email }
7+
password { 'password123' }
8+
password_confirmation { 'password123' }
9+
full_name { Faker::Name.name }
10+
role { 'analyst' }
11+
12+
trait :owner do
13+
role { 'owner' }
14+
end
15+
16+
trait :admin do
17+
role { 'admin' }
18+
end
19+
20+
trait :coach do
21+
role { 'coach' }
22+
end
23+
24+
trait :analyst do
25+
role { 'analyst' }
26+
end
27+
28+
trait :viewer do
29+
role { 'viewer' }
30+
end
31+
end
32+
end

spec/factories/vod_reviews.rb

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
1-
FactoryBot.define do
2-
factory :vod_review do
3-
association :organization
4-
association :reviewer, factory: :user
5-
association :match, factory: :match
6-
7-
title { Faker::Lorem.sentence(word_count: 3) }
8-
description { Faker::Lorem.paragraph }
9-
review_type { %w[team individual opponent].sample }
10-
review_date { Faker::Time.between(from: 30.days.ago, to: Time.current) }
11-
video_url { "https://www.youtube.com/watch?v=#{Faker::Alphanumeric.alpha(number: 11)}" }
12-
thumbnail_url { Faker::Internet.url }
13-
duration { rand(1800..3600) }
14-
status { 'draft' }
15-
is_public { false }
16-
tags { %w[scrim review analysis].sample(2) }
17-
18-
trait :published do
19-
status { 'published' }
20-
end
21-
22-
trait :archived do
23-
status { 'archived' }
24-
end
25-
26-
trait :public do
27-
is_public { true }
28-
share_link { SecureRandom.urlsafe_base64(16) }
29-
end
30-
31-
trait :with_timestamps do
32-
after(:create) do |vod_review|
33-
create_list(:vod_timestamp, 3, vod_review: vod_review)
34-
end
35-
end
36-
end
37-
end
1+
# frozen_string_literal: true
2+
3+
FactoryBot.define do
4+
factory :vod_review do
5+
association :organization
6+
association :reviewer, factory: :user
7+
association :match, factory: :match
8+
9+
title { Faker::Lorem.sentence(word_count: 3) }
10+
description { Faker::Lorem.paragraph }
11+
review_type { %w[team individual opponent].sample }
12+
review_date { Faker::Time.between(from: 30.days.ago, to: Time.current) }
13+
video_url { "https://www.youtube.com/watch?v=#{Faker::Alphanumeric.alpha(number: 11)}" }
14+
thumbnail_url { Faker::Internet.url }
15+
duration { rand(1800..3600) }
16+
status { 'draft' }
17+
is_public { false }
18+
tags { %w[scrim review analysis].sample(2) }
19+
20+
trait :published do
21+
status { 'published' }
22+
end
23+
24+
trait :archived do
25+
status { 'archived' }
26+
end
27+
28+
trait :public do
29+
is_public { true }
30+
share_link { SecureRandom.urlsafe_base64(16) }
31+
end
32+
33+
trait :with_timestamps do
34+
after(:create) do |vod_review|
35+
create_list(:vod_timestamp, 3, vod_review: vod_review)
36+
end
37+
end
38+
end
39+
end

spec/factories/vod_timestamps.rb

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1-
FactoryBot.define do
2-
factory :vod_timestamp do
3-
association :vod_review
4-
association :target_player, factory: :player
5-
association :created_by, factory: :user
6-
7-
timestamp_seconds { rand(60..3600) }
8-
title { Faker::Lorem.sentence(word_count: 3) }
9-
description { Faker::Lorem.paragraph }
10-
category { %w[mistake good_play team_fight objective laning].sample }
11-
importance { %w[low normal high critical].sample }
12-
target_type { %w[player team opponent].sample }
13-
14-
trait :mistake do
15-
category { 'mistake' }
16-
importance { %w[high critical].sample }
17-
end
18-
19-
trait :good_play do
20-
category { 'good_play' }
21-
end
22-
23-
trait :critical do
24-
importance { 'critical' }
25-
end
26-
27-
trait :important do
28-
importance { 'high' }
29-
end
30-
end
31-
end
1+
# frozen_string_literal: true
2+
3+
FactoryBot.define do
4+
factory :vod_timestamp do
5+
association :vod_review
6+
association :target_player, factory: :player
7+
association :created_by, factory: :user
8+
9+
timestamp_seconds { rand(60..3600) }
10+
title { Faker::Lorem.sentence(word_count: 3) }
11+
description { Faker::Lorem.paragraph }
12+
category { %w[mistake good_play team_fight objective laning].sample }
13+
importance { %w[low normal high critical].sample }
14+
target_type { %w[player team opponent].sample }
15+
16+
trait :mistake do
17+
category { 'mistake' }
18+
importance { %w[high critical].sample }
19+
end
20+
21+
trait :good_play do
22+
category { 'good_play' }
23+
end
24+
25+
trait :critical do
26+
importance { 'critical' }
27+
end
28+
29+
trait :important do
30+
importance { 'high' }
31+
end
32+
end
33+
end

0 commit comments

Comments
 (0)