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:
@@ -38,7 +38,7 @@ describe "Images", :admin do
|
||||
expect(page).not_to have_content("clippy.jpg")
|
||||
|
||||
visit new_admin_answer_image_path(answer)
|
||||
imageable_attach_new_file(Rails.root.join("spec/fixtures/files/clippy.jpg"))
|
||||
imageable_attach_new_file(file_fixture("clippy.jpg"))
|
||||
click_button "Save image"
|
||||
|
||||
expect(page).to have_css("img[title='clippy.jpg']")
|
||||
|
||||
Reference in New Issue
Block a user