about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2023-02-21 19:57:15 -0500
committerGitHub <noreply@github.com>2023-02-22 09:57:15 +0900
commit8fd3fc404dd848253767252bbd76275e091832b1 (patch)
tree05dac486f88021edebe5c27edc8466f1484e9114 /spec
parent48aeab90f657055e5516b844f47fcf5c097458a1 (diff)
Autofix Rubocop Rails/RootPathnameMethods (#23760)
Diffstat (limited to 'spec')
-rw-r--r--spec/fabricators/custom_emoji_fabricator.rb2
-rw-r--r--spec/fabricators/site_upload_fabricator.rb2
-rw-r--r--spec/rails_helper.rb4
3 files changed, 4 insertions, 4 deletions
diff --git a/spec/fabricators/custom_emoji_fabricator.rb b/spec/fabricators/custom_emoji_fabricator.rb
index 298a50b4b..fa570eec6 100644
--- a/spec/fabricators/custom_emoji_fabricator.rb
+++ b/spec/fabricators/custom_emoji_fabricator.rb
@@ -3,5 +3,5 @@
 Fabricator(:custom_emoji) do
   shortcode 'coolcat'
   domain    nil
-  image     { File.open(Rails.root.join('spec', 'fixtures', 'files', 'emojo.png')) }
+  image     { Rails.root.join('spec', 'fixtures', 'files', 'emojo.png').open }
 end
diff --git a/spec/fabricators/site_upload_fabricator.rb b/spec/fabricators/site_upload_fabricator.rb
index b6841dea3..ad1b777cc 100644
--- a/spec/fabricators/site_upload_fabricator.rb
+++ b/spec/fabricators/site_upload_fabricator.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
 
 Fabricator(:site_upload) do
-  file { File.open(File.join(Rails.root, 'spec', 'fabricators', 'assets', 'utah_teapot.png')) }
+  file { Rails.root.join('spec', 'fabricators', 'assets', 'utah_teapot.png').open }
 end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index faae02df0..70d3a968c 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -73,11 +73,11 @@ end
 RSpec::Matchers.define_negated_matcher :not_change, :change
 
 def request_fixture(name)
-  File.read(Rails.root.join('spec', 'fixtures', 'requests', name))
+  Rails.root.join('spec', 'fixtures', 'requests', name).read
 end
 
 def attachment_fixture(name)
-  File.open(Rails.root.join('spec', 'fixtures', 'files', name))
+  Rails.root.join('spec', 'fixtures', 'files', name).open
 end
 
 def stub_jsonld_contexts!