Allow change map image from admin site customization

Also adds on site customization image.rb jpeg content type to allow replace this image.
This commit is contained in:
decabeza
2019-01-24 11:48:25 +01:00
parent 7e89cc149f
commit 045c4eca64
5 changed files with 46 additions and 10 deletions

View File

@@ -7,22 +7,57 @@ feature "Admin custom images" do
login_as(admin.user)
end
scenario "Upload valid image" do
scenario "Upload valid png image" do
visit admin_root_path
within("#side_menu") do
click_link "Custom images"
end
within("tr.logo_header") do
within("tr#image_logo_header") do
attach_file "site_customization_image_image", "spec/fixtures/files/logo_header.png"
click_button "Update"
end
expect(page).to have_css("tr.logo_header img[src*='logo_header.png']")
expect(page).to have_css("tr#image_logo_header img[src*='logo_header.png']")
expect(page).to have_css("img[src*='logo_header.png']", count: 1)
end
scenario "Upload valid jpg image" do
visit admin_root_path
within("#side_menu") do
click_link "Custom images"
end
within("tr#image_map") do
attach_file "site_customization_image_image", "spec/fixtures/files/custom_map.jpg"
click_button "Update"
end
expect(page).to have_css("tr#image_map img[src*='custom_map.jpg']")
expect(page).to have_css("img[src*='custom_map.jpg']", count: 1)
end
scenario "Image is replaced on front view" do
visit admin_root_path
within("#side_menu") do
click_link "Custom images"
end
within("tr#image_map") do
attach_file "site_customization_image_image", "spec/fixtures/files/custom_map.jpg"
click_button "Update"
end
visit proposals_path
within("#map") do
expect(page).to have_css("img[src*='custom_map.jpg']")
end
end
scenario "Upload invalid image" do
visit admin_root_path
@@ -30,7 +65,7 @@ feature "Admin custom images" do
click_link "Custom images"
end
within("tr.social_media_icon") do
within("tr#image_social_media_icon") do
attach_file "site_customization_image_image", "spec/fixtures/files/logo_header.png"
click_button "Update"
end
@@ -46,14 +81,14 @@ feature "Admin custom images" do
click_link "Custom images"
end
within("tr.social_media_icon") do
within("tr#image_social_media_icon") do
attach_file "site_customization_image_image", "spec/fixtures/files/social_media_icon.png"
click_button "Update"
end
expect(page).to have_css("img[src*='social_media_icon.png']")
within("tr.social_media_icon") do
within("tr#image_social_media_icon") do
click_link "Delete"
end