Use the file_fixture helper in tests
This way we don't have to write `"spec/fixtures/files"` every time. Note this method isn't included in factories. We could include it like so: ``` FactoryBot::SyntaxRunner.class_eval do include ActiveSupport::Testing::FileFixtures self.file_fixture_path = RSpec.configuration.file_fixture_path end ``` However, I'm not sure about the possible side effects, and since we only use attachments in a few factories, there isn't much gain in applying the monkey-patch.
This commit is contained in:
@@ -35,7 +35,7 @@ describe "active storage tasks" do
|
||||
end
|
||||
|
||||
it "does not modify old ckeditor attachments" do
|
||||
image = Ckeditor::Picture.create!(data: Rack::Test::UploadedFile.new("spec/fixtures/files/clippy.png"))
|
||||
image = Ckeditor::Picture.create!(data: Rack::Test::UploadedFile.new(file_fixture("clippy.png")))
|
||||
|
||||
expect(image.storage_data.attachment.name).to eq "storage_data"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user