Use absolute paths for fixtures
This commit is contained in:
@@ -47,7 +47,11 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
||||
|
||||
click_link "Add image"
|
||||
image_input = find(".image").find("input[type=file]", visible: false)
|
||||
attach_file(image_input[:id], "spec/fixtures/files/clippy.jpg", make_visible: true)
|
||||
attach_file(
|
||||
image_input[:id],
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg'),
|
||||
make_visible: true
|
||||
)
|
||||
|
||||
expect(page).to have_selector ".file-name", text: "clippy.jpg"
|
||||
end
|
||||
@@ -56,7 +60,10 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
||||
login_as user
|
||||
visit send(path, arguments)
|
||||
|
||||
imageable_attach_new_file(imageable_factory_name, "spec/fixtures/files/clippy.jpg")
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg')
|
||||
)
|
||||
|
||||
expect_image_has_title("clippy.jpg")
|
||||
end
|
||||
@@ -69,7 +76,11 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
||||
input_title = find(".image input[name$='[title]']")
|
||||
fill_in input_title[:id], with: "Title"
|
||||
image_input = find(".image").find("input[type=file]", visible: false)
|
||||
attach_file(image_input[:id], "spec/fixtures/files/clippy.jpg", make_visible: true)
|
||||
attach_file(
|
||||
image_input[:id],
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg'),
|
||||
make_visible: true
|
||||
)
|
||||
|
||||
if has_many_images
|
||||
expect(find("input[id$='_title']").value).to eq "Title"
|
||||
@@ -82,7 +93,10 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
||||
login_as user
|
||||
visit send(path, arguments)
|
||||
|
||||
imageable_attach_new_file(imageable_factory_name, "spec/fixtures/files/clippy.jpg")
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg')
|
||||
)
|
||||
|
||||
expect(page).to have_selector ".loading-bar.complete"
|
||||
end
|
||||
@@ -91,7 +105,11 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
||||
login_as user
|
||||
visit send(path, arguments)
|
||||
|
||||
imageable_attach_new_file(imageable_factory_name, "spec/fixtures/files/logo_header.png", false)
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/logo_header.png'),
|
||||
false
|
||||
)
|
||||
|
||||
expect(page).to have_selector ".loading-bar.errors"
|
||||
end
|
||||
@@ -100,7 +118,10 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
||||
login_as user
|
||||
visit send(path, arguments)
|
||||
|
||||
imageable_attach_new_file(imageable_factory_name, "spec/fixtures/files/clippy.jpg")
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg')
|
||||
)
|
||||
|
||||
expect_image_has_cached_attachment(".jpg")
|
||||
end
|
||||
@@ -109,7 +130,11 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
||||
login_as user
|
||||
visit send(path, arguments)
|
||||
|
||||
imageable_attach_new_file(imageable_factory_name, "spec/fixtures/files/logo_header.png", false)
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/logo_header.png'),
|
||||
false
|
||||
)
|
||||
|
||||
expect_image_has_cached_attachment("")
|
||||
end
|
||||
@@ -134,7 +159,11 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
||||
login_as user
|
||||
visit send(path, arguments)
|
||||
|
||||
imageable_attach_new_file(imageable_factory_name, "spec/fixtures/files/clippy.jpg")
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg')
|
||||
)
|
||||
|
||||
within "#nested-image .image" do
|
||||
click_link "Remove image"
|
||||
end
|
||||
@@ -161,7 +190,11 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
||||
visit send(path, arguments)
|
||||
send(fill_resource_method_name) if fill_resource_method_name
|
||||
|
||||
imageable_attach_new_file(imageable_factory_name, "spec/fixtures/files/clippy.jpg")
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg')
|
||||
)
|
||||
|
||||
click_on submit_button
|
||||
|
||||
expect(page).to have_content imageable_success_notice
|
||||
@@ -172,7 +205,11 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
||||
visit send(path, arguments)
|
||||
send(fill_resource_method_name) if fill_resource_method_name
|
||||
|
||||
imageable_attach_new_file(imageable_factory_name, "spec/fixtures/files/clippy.jpg")
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg')
|
||||
)
|
||||
|
||||
click_on submit_button
|
||||
imageable_redirected_to_resource_show_or_navigate_to
|
||||
|
||||
@@ -279,4 +316,4 @@ def expect_image_has_cached_attachment(extension)
|
||||
expect(find("input[name$='[cached_attachment]']", visible: false).value).to end_with(extension)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user