Skip to content

Commit

Permalink
Merge pull request #7324 from fjordllc/feature/apply-rubocop-rule-8
Browse files Browse the repository at this point in the history
Style/HashSyntaxを10個のファイルに適用-8
  • Loading branch information
komagata authored Feb 10, 2024
2 parents e3ba132 + f002081 commit d771a5f
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 51 deletions.
10 changes: 0 additions & 10 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,3 @@ Style/HashSyntax:
- 'test/supports/api_helper.rb'
- 'test/supports/tag_helper.rb'
- 'test/system/announcements_test.rb'
- 'test/system/company/products_test.rb'
- 'test/system/current_user/products_test.rb'
- 'test/system/notification/products_test.rb'
- 'test/system/notification/questions_test.rb'
- 'test/system/notification/signed_up_test.rb'
- 'test/system/product/self_assigned_test.rb'
- 'test/system/product/unchecked_test.rb'
- 'test/system/sign_up_test.rb'
- 'test/system/user/products_test.rb'
- 'test/test_helper.rb'
6 changes: 3 additions & 3 deletions test/system/company/products_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class Company::ProductsTest < ApplicationSystemTestCase
user.update(company: companies(:company1))

# id順で並べたときの最初と最後の提出物を、作成日順で見たときに最新と最古になるように入れ替える
Product.where(user: user).update_all(created_at: 1.day.ago, published_at: 1.day.ago) # rubocop:disable Rails/SkipsModelValidations
newest_product = Product.where(user: user).first
Product.where(user:).update_all(created_at: 1.day.ago, published_at: 1.day.ago) # rubocop:disable Rails/SkipsModelValidations
newest_product = Product.where(user:).first
newest_product_decorated_author = ActiveDecorator::Decorator.instance.decorate(newest_product.user)
newest_product.update(created_at: Time.current)
oldest_product = Product.where(user: user).last
oldest_product = Product.where(user:).last
oldest_product_decorated_author = ActiveDecorator::Decorator.instance.decorate(oldest_product.user)
oldest_product.update(created_at: 2.days.ago)

Expand Down
6 changes: 3 additions & 3 deletions test/system/current_user/products_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class CurrentUser::ProductsTest < ApplicationSystemTestCase
user = users(:with_hyphen)

# id順で並べたときの最初と最後の提出物を、作成日順で見たときに最新と最古になるように入れ替える
Product.where(user: user).update_all(created_at: 1.day.ago, published_at: 1.day.ago) # rubocop:disable Rails/SkipsModelValidations
newest_product = Product.where(user: user).first
Product.where(user:).update_all(created_at: 1.day.ago, published_at: 1.day.ago) # rubocop:disable Rails/SkipsModelValidations
newest_product = Product.where(user:).first
newest_product.update(created_at: Time.current)
oldest_product = Product.where(user: user).last
oldest_product = Product.where(user:).last
oldest_product.update(created_at: 2.days.ago)

visit_with_auth '/current_user/products', user.login_name
Expand Down
4 changes: 2 additions & 2 deletions test/system/notification/products_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class Notification::ProductsTest < ApplicationSystemTestCase
user = users(:kimura)
product = Product.create!(
body: 'test',
user: user,
practice: practice,
user:,
practice:,
checker_id: checker.id
)
visit_with_auth "/products/#{product.id}", 'komagata'
Expand Down
2 changes: 1 addition & 1 deletion test/system/notification/questions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class Notification::QuestionsTest < ApplicationSystemTestCase
Answer.create!(
description: '最後の回答',
user: answerer,
question: question,
question:,
created_at: '2022-10-31',
updated_at: '2022-10-31'
)
Expand Down
4 changes: 2 additions & 2 deletions test/system/notification/signed_up_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Notification::SignedUpTest < ApplicationSystemTestCase

click_button 'アドバイザー登録'
assert_text 'サインアップメールをお送りしました。メールからサインアップを完了させてください。'
assert User.find_by(email: email).adviser?
assert User.find_by(email:).adviser?

visit_with_auth notifications_path, 'komagata'
within first('.card-list-item.is-unread') do
Expand Down Expand Up @@ -69,7 +69,7 @@ class Notification::SignedUpTest < ApplicationSystemTestCase

click_button '参加する'
assert_text 'サインアップメールをお送りしました。メールからサインアップを完了させてください。'
assert User.find_by(email: email).trainee?
assert User.find_by(email:).trainee?

visit_with_auth notifications_path, 'komagata'
within first('.card-list-item.is-unread') do
Expand Down
16 changes: 8 additions & 8 deletions test/system/product/self_assigned_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ class Product::SelfAssignedTest < ApplicationSystemTestCase
decorated_user = ActiveDecorator::Decorator.instance.decorate(user)
Product.create!(
body: 'test',
user: user,
practice: practice,
user:,
practice:,
checker_id: checker.id
)
visit_with_auth '/products/self_assigned', 'mentormentaro'
Expand All @@ -86,8 +86,8 @@ class Product::SelfAssignedTest < ApplicationSystemTestCase
decorated_user = ActiveDecorator::Decorator.instance.decorate(user)
Product.create!(
body: 'test',
user: user,
practice: practice,
user:,
practice:,
checker_id: checker.id
)
visit_with_auth '/products/self_assigned?target=self_assigned_no_replied', 'mentormentaro'
Expand Down Expand Up @@ -130,8 +130,8 @@ class Product::SelfAssignedTest < ApplicationSystemTestCase
decorated_user = ActiveDecorator::Decorator.instance.decorate(user)
product = Product.create!(
body: 'test',
user: user,
practice: practice,
user:,
practice:,
checker_id: checker.id
)
visit_with_auth "/products/#{product.id}", 'mentormentaro'
Expand Down Expand Up @@ -187,13 +187,13 @@ class Product::SelfAssignedTest < ApplicationSystemTestCase
Product.create!(
body: 'test',
user: unhibernated_user,
practice: practice,
practice:,
checker_id: checker.id
)
Product.create!(
body: 'test',
user: hibernated_user,
practice: practice,
practice:,
checker_id: checker.id
)

Expand Down
26 changes: 13 additions & 13 deletions test/system/product/unchecked_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class Product::UncheckedTest < ApplicationSystemTestCase
user = users(:mentormentaro)
product = Product.create!(
body: 'test',
user: user,
practice: practice,
user:,
practice:,
checker_id: checker.id
)
visit_with_auth "/products/#{product.id}", 'komagata'
Expand All @@ -69,8 +69,8 @@ class Product::UncheckedTest < ApplicationSystemTestCase
user = users(:kimura)
product = Product.create!(
body: 'test',
user: user,
practice: practice,
user:,
practice:,
checker_id: checker.id
)
visit_with_auth "/products/#{product.id}", 'kimura'
Expand Down Expand Up @@ -121,8 +121,8 @@ class Product::UncheckedTest < ApplicationSystemTestCase
user = users(:kimura)
product = Product.create!(
body: 'test',
user: user,
practice: practice,
user:,
practice:,
checker_id: checker.id
)
visit_with_auth "/products/#{product.id}", 'kimura'
Expand All @@ -139,8 +139,8 @@ class Product::UncheckedTest < ApplicationSystemTestCase
user = users(:kimura)
product = Product.create!(
body: 'test',
user: user,
practice: practice,
user:,
practice:,
checker_id: checker.id
)
visit_with_auth "/products/#{product.id}", 'komagata'
Expand All @@ -167,8 +167,8 @@ class Product::UncheckedTest < ApplicationSystemTestCase
checker = users(:komagata)
product = Product.create!(
body: 'test',
user: user,
practice: practice,
user:,
practice:,
checker_id: checker.id
)

Expand All @@ -187,8 +187,8 @@ class Product::UncheckedTest < ApplicationSystemTestCase
checker = users(:komagata)
product = Product.create!(
body: 'test',
user: user,
practice: practice,
user:,
practice:,
checker_id: checker.id
)

Expand All @@ -214,7 +214,7 @@ class Product::UncheckedTest < ApplicationSystemTestCase
Product.create!(
body: 'hiberanated user product.',
user: hiberanated_user,
practice: practice,
practice:,
checker_id: nil
)

Expand Down
10 changes: 5 additions & 5 deletions test/system/sign_up_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class SignUpTest < ApplicationSystemTestCase

click_button 'アドバイザー登録'
assert_text 'サインアップメールをお送りしました。メールからサインアップを完了させてください。'
assert User.find_by(email: email).adviser?
assert User.find_by(email:).adviser?
end

test 'sign up as trainee' do
Expand Down Expand Up @@ -161,7 +161,7 @@ class SignUpTest < ApplicationSystemTestCase

click_button '参加する'
assert_text 'サインアップメールをお送りしました。メールからサインアップを完了させてください。'
assert User.find_by(email: email).trainee?
assert User.find_by(email:).trainee?
end

test 'form item about job seek is only displayed to students' do
Expand Down Expand Up @@ -217,7 +217,7 @@ class SignUpTest < ApplicationSystemTestCase

click_button 'アドバイザー登録'
assert_text 'サインアップメールをお送りしました。メールからサインアップを完了させてください。'
assert_equal User.find_by(email: email).company_id, companies(:company2).id
assert_equal User.find_by(email:).company_id, companies(:company2).id
end

test 'sign up as trainee with course_id' do
Expand Down Expand Up @@ -246,7 +246,7 @@ class SignUpTest < ApplicationSystemTestCase
end

click_button '参加する'
assert_equal User.find_by(email: email).course_id, course.id
assert_equal User.find_by(email:).course_id, course.id
end

test 'sign up with empty description ' do
Expand Down Expand Up @@ -301,7 +301,7 @@ class SignUpTest < ApplicationSystemTestCase
VCR.use_cassette 'sign_up/tag', record: :once, match_requests_on: %i[method uri] do
click_button '参加する'
assert_text 'サインアップメールをお送りしました。メールからサインアップを完了させてください。'
user = User.find_by(email: email)
user = User.find_by(email:)
visit_with_auth user_path(user), 'taguo'
assert_text 'タグ夫'
end
Expand Down
6 changes: 3 additions & 3 deletions test/system/user/products_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class User::ProductsTest < ApplicationSystemTestCase
user = users(:with_hyphen)

# id順で並べたときの最初と最後の提出物を、作成日順で見たときに最新と最古になるように入れ替える
Product.where(user: user).update_all(created_at: 1.day.ago, published_at: 1.day.ago) # rubocop:disable Rails/SkipsModelValidations
newest_product = Product.where(user: user).first
Product.where(user:).update_all(created_at: 1.day.ago, published_at: 1.day.ago) # rubocop:disable Rails/SkipsModelValidations
newest_product = Product.where(user:).first
newest_product.update(created_at: Time.current)
oldest_product = Product.where(user: user).last
oldest_product = Product.where(user:).last
oldest_product.update(created_at: 2.days.ago)

visit_with_auth "/users/#{user.id}/products", 'komagata'
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ActionDispatch::IntegrationTest
module BlobFixtureSet
def fixture(filename:, **attributes)
blob = new(
filename: filename,
filename:,
key: generate_unique_secure_token
)
io = Rails.root.join("test/fixtures/files/#{filename}").open
Expand Down

0 comments on commit d771a5f

Please sign in to comment.