diff --git a/.rubocop_manual_todo.yml b/.rubocop_manual_todo.yml
index 5c55f6ef9e..7fda4bb730 100644
--- a/.rubocop_manual_todo.yml
+++ b/.rubocop_manual_todo.yml
@@ -167,7 +167,6 @@ Layout/LineLength:
- spec/features/admin/enterprises/index_spec.rb
- spec/features/admin/enterprises_spec.rb
- spec/features/admin/enterprise_user_spec.rb
- - spec/features/admin/image_settings_spec.rb
- spec/features/admin/multilingual_spec.rb
- spec/features/admin/order_cycles/complex_creating_specific_time_spec.rb
- spec/features/admin/order_cycles/complex_editing_multiple_product_pages_spec.rb
@@ -345,7 +344,6 @@ Metrics/AbcSize:
- app/controllers/cart_controller.rb
- app/controllers/discourse_sso_controller.rb
- app/controllers/enterprises_controller.rb
- - app/controllers/spree/admin/image_settings_controller.rb
- app/controllers/spree/admin/orders_controller.rb
- app/controllers/spree/admin/orders/customer_details_controller.rb
- app/controllers/spree/admin/overview_controller.rb
@@ -665,7 +663,6 @@ Metrics/MethodLength:
- app/controllers/api/variants_controller.rb
- app/controllers/cart_controller.rb
- app/controllers/shop_controller.rb
- - app/controllers/spree/admin/image_settings_controller.rb
- app/controllers/spree/admin/orders_controller.rb
- app/controllers/spree/admin/orders/customer_details_controller.rb
- app/controllers/spree/admin/payment_methods_controller.rb
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 2c867c2ec1..93648258a3 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -691,7 +691,6 @@ Style/FrozenStringLiteralComment:
- 'app/controllers/spree/admin/base_controller.rb'
- 'app/controllers/spree/admin/countries_controller.rb'
- 'app/controllers/spree/admin/general_settings_controller.rb'
- - 'app/controllers/spree/admin/image_settings_controller.rb'
- 'app/controllers/spree/admin/images_controller.rb'
- 'app/controllers/spree/admin/invoices_controller.rb'
- 'app/controllers/spree/admin/mail_methods_controller.rb'
@@ -726,7 +725,6 @@ Style/FrozenStringLiteralComment:
- 'app/controllers/user_passwords_controller.rb'
- 'app/controllers/user_registrations_controller.rb'
- 'app/helpers/admin/enterprises_helper.rb'
- - 'app/helpers/admin/image_settings_helper.rb'
- 'app/helpers/admin/injection_helper.rb'
- 'app/helpers/admin/orders_helper.rb'
- 'app/helpers/admin/subscriptions_helper.rb'
@@ -1123,7 +1121,6 @@ Style/FrozenStringLiteralComment:
- 'spec/controllers/shops_controller_spec.rb'
- 'spec/controllers/spree/admin/adjustments_controller_spec.rb'
- 'spec/controllers/spree/admin/base_controller_spec.rb'
- - 'spec/controllers/spree/admin/image_settings_controller_spec.rb'
- 'spec/controllers/spree/admin/invoices_controller_spec.rb'
- 'spec/controllers/spree/admin/mail_methods_controller_spec.rb'
- 'spec/controllers/spree/admin/orders/customer_details_controller_spec.rb'
@@ -1168,7 +1165,6 @@ Style/FrozenStringLiteralComment:
- 'spec/features/admin/bulk_product_update_spec.rb'
- 'spec/features/admin/configuration/content_spec.rb'
- 'spec/features/admin/configuration/general_settings_spec.rb'
- - 'spec/features/admin/configuration/image_settings_spec.rb'
- 'spec/features/admin/configuration/mail_methods_spec.rb'
- 'spec/features/admin/configuration/states_spec.rb'
- 'spec/features/admin/configuration/tax_categories_spec.rb'
@@ -1184,7 +1180,6 @@ Style/FrozenStringLiteralComment:
- 'spec/features/admin/enterprises/index_spec.rb'
- 'spec/features/admin/enterprises_spec.rb'
- 'spec/features/admin/external_services_spec.rb'
- - 'spec/features/admin/image_settings_spec.rb'
- 'spec/features/admin/multilingual_spec.rb'
- 'spec/features/admin/overview_spec.rb'
- 'spec/features/admin/payment_method_spec.rb'
diff --git a/app/assets/javascripts/admin/spree/image_settings.js.erb b/app/assets/javascripts/admin/spree/image_settings.js.erb
deleted file mode 100644
index d8c0b2a635..0000000000
--- a/app/assets/javascripts/admin/spree/image_settings.js.erb
+++ /dev/null
@@ -1,59 +0,0 @@
-$(document).ready(function() {
-
- if ($('input#preferences_use_s3[type="checkbox"]:checked').length > 0) {
- $('#s3_settings, #s3_headers').show();
- }
-
- // Toggle display of S3 settings based on value of use_s3 checkbox
- $('input#preferences_use_s3[type="checkbox"]').click(function() {
- $('#s3_settings, #s3_headers').toggle();
- });
-
- $(document).on('click', '.destroy_style', function(e) {
- e.preventDefault();
- $(this).parent().remove();
- });
-
- $(document).on('click', '.destroy_new_attachment_styles', function(e) {
- e.preventDefault();
- $(this).closest('.new_attachment_styles').remove();
- });
-
- $(document).on('click', '.destroy_new_s3_headers', function(e) {
- e.preventDefault();
- $(this).closest('.new_s3_headers').remove();
- });
-
- // Handle adding new styles
- var styles_hash_index = 1;
- $(document).on('click', '.add_new_style', function(e) {
- e.preventDefault();
- $('#new-styles').append(generate_html_for_hash("new_attachment_styles", styles_hash_index));
- });
-
- // Handle adding new headers
- var headers_hash_index = 1;
- $(document).on('click', '.add_header', function(e) {
- e.preventDefault();
- $('#headers_list').append(generate_html_for_hash("new_s3_headers", headers_hash_index));
- });
-
- // Generates html for new paperclip styles form fields
- generate_html_for_hash = function(hash_name, index) {
- var html = '
';
-
- index += 1;
- return html;
- };
-});
diff --git a/app/assets/stylesheets/admin/all.scss b/app/assets/stylesheets/admin/all.scss
index 6d5992f8d4..65d555e561 100644
--- a/app/assets/stylesheets/admin/all.scss
+++ b/app/assets/stylesheets/admin/all.scss
@@ -35,7 +35,6 @@
@import 'plugins/font-awesome';
@import 'plugins/select2';
-@import 'sections/image_settings';
@import 'sections/orders';
@import 'sections/products';
diff --git a/app/assets/stylesheets/admin/hacks/ie.scss b/app/assets/stylesheets/admin/hacks/ie.scss
index ba5cd61501..4eff79ed84 100644
--- a/app/assets/stylesheets/admin/hacks/ie.scss
+++ b/app/assets/stylesheets/admin/hacks/ie.scss
@@ -29,11 +29,6 @@ html.ie {
z-index: 0;
}
}
-
- // Fix margin-top for destroy paperclip styles background
- .destroy_new_attachment_styles {
- margin-top: 17px !important;
- }
}
// IE8 Hacks
diff --git a/app/assets/stylesheets/admin/sections/image_settings.scss b/app/assets/stylesheets/admin/sections/image_settings.scss
deleted file mode 100644
index dc7a29b1b2..0000000000
--- a/app/assets/stylesheets/admin/sections/image_settings.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-.destroy_style, .destroy_header {
- float: right;
-}
diff --git a/app/assets/stylesheets/admin/shared/layout.scss b/app/assets/stylesheets/admin/shared/layout.scss
index 4288e88266..17af56a59b 100644
--- a/app/assets/stylesheets/admin/shared/layout.scss
+++ b/app/assets/stylesheets/admin/shared/layout.scss
@@ -71,12 +71,6 @@
display: none;
}
-// For block grids
-.frameless {
- margin-left: -10px;
- margin-right: -10px;
-}
-
// Header
//---------------------------------------------------
#header {
diff --git a/app/controllers/spree/admin/image_settings_controller.rb b/app/controllers/spree/admin/image_settings_controller.rb
deleted file mode 100644
index 476dd401a8..0000000000
--- a/app/controllers/spree/admin/image_settings_controller.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-module Spree
- module Admin
- class ImageSettingsController < Spree::Admin::BaseController
- def edit
- @styles = ActiveSupport::JSON.decode(Spree::Config[:attachment_styles])
- @headers = ActiveSupport::JSON.decode(Spree::Config[:s3_headers])
- end
-
- def update
- update_styles(params)
- update_headers(params) if Spree::Config[:use_s3]
-
- Spree::Config.set(params[:preferences])
- update_paperclip_settings
-
- respond_to do |format|
- format.html {
- flash[:success] = Spree.t(:image_settings_updated)
- redirect_to spree.edit_admin_image_settings_path
- }
- end
- end
-
- private
-
- def update_styles(params)
- if params[:new_attachment_styles].present?
- params[:new_attachment_styles].each do |_index, style|
- params[:attachment_styles][style[:name]] = style[:value] if style[:value].present?
- end
- end
-
- styles = params[:attachment_styles]
-
- Spree::Config[:attachment_styles] = ActiveSupport::JSON.encode(styles) unless styles.nil?
- end
-
- def update_headers(params)
- if params[:new_s3_headers].present?
- params[:new_s3_headers].each do |_index, header|
- params[:s3_headers][header[:name]] = header[:value] if header[:value].present?
- end
- end
-
- headers = params[:s3_headers]
-
- Spree::Config[:s3_headers] = ActiveSupport::JSON.encode(headers) unless headers.nil?
- end
-
- def update_paperclip_settings
- if Spree::Config[:use_s3]
- s3_creds = { access_key_id: Spree::Config[:s3_access_key],
- secret_access_key: Spree::Config[:s3_secret],
- bucket: Spree::Config[:s3_bucket] }
- Spree::Image.attachment_definitions[:attachment][:storage] = :s3
- Spree::Image.attachment_definitions[:attachment][:s3_credentials] = s3_creds
- Spree::Image.attachment_definitions[:attachment][:s3_headers] =
- ActiveSupport::JSON.decode(Spree::Config[:s3_headers])
- Spree::Image.attachment_definitions[:attachment][:bucket] = Spree::Config[:s3_bucket]
- else
- Spree::Image.attachment_definitions[:attachment].delete :storage
- end
-
- Spree::Image.attachment_definitions[:attachment][:styles] =
- ActiveSupport::JSON.decode(Spree::Config[:attachment_styles]).symbolize_keys!
- Spree::Image.attachment_definitions[:attachment][:path] = Spree::Config[:attachment_path]
- Spree::Image.attachment_definitions[:attachment][:default_url] =
- Spree::Config[:attachment_default_url]
- Spree::Image.attachment_definitions[:attachment][:default_style] =
- Spree::Config[:attachment_default_style]
-
- # Spree stores attachent definitions in JSON. This converts the style name and format to
- # strings. However, when paperclip encounters these, it doesn't recognise the format.
- # Here we solve that problem by converting format and style name to symbols.
- Spree::Image.reformat_styles
- end
- end
- end
-end
diff --git a/app/helpers/admin/image_settings_helper.rb b/app/helpers/admin/image_settings_helper.rb
deleted file mode 100644
index e337161298..0000000000
--- a/app/helpers/admin/image_settings_helper.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-module Admin
- module ImageSettingsHelper
- def admin_image_settings_format_options
- [['Unchanged', ''], ['PNG', 'png'], ['JPEG', 'jpg']]
- end
-
- def admin_image_settings_geometry_from_style(style)
- geometry, _format = admin_image_settings_split_style style
- geometry
- end
-
- def admin_image_settings_format_from_style(style)
- _geometry, format = admin_image_settings_split_style style
- format
- end
-
- def admin_image_settings_split_style(style)
- [style, nil].flatten[0..1]
- end
- end
-end
diff --git a/app/views/spree/admin/image_settings/edit.html.haml b/app/views/spree/admin/image_settings/edit.html.haml
deleted file mode 100644
index 4345755792..0000000000
--- a/app/views/spree/admin/image_settings/edit.html.haml
+++ /dev/null
@@ -1,81 +0,0 @@
-= render :partial => 'spree/admin/shared/configuration_menu'
-
-- content_for :page_title do
- = Spree.t(:image_settings)
-
-= form_tag admin_image_settings_path, :method => :put do
- - destroy = Spree.t(:destroy)
-
- %fieldset.no-border-top
- %fieldset.no-border-bottom
- %legend{:align => "center"}= Spree.t(:general_settings)
- .field
- .warning.note= Spree.t(:image_settings_warning)
-
- .field{"data-hook" => "attachment_path"}
- = label_tag 'preferences[attachment_path]', Spree.t(:attachment_path)
- = preference_field_tag 'preferences[attachment_path]', Spree::Config[:attachment_path], :type => :string
- .alpha.eight.columns
- .field{"data-hook" => "attachment_default_url"}
- = label_tag 'preferences[attachment_default_url]', Spree.t(:attachment_default_url)
- = preference_field_tag 'preferences[attachment_default_url]', Spree::Config[:attachment_default_url], :type => :string
- .alpha.eight.columns
- .field{"data-hook" => "attachment_url"}
- = label_tag 'preferences[attachment_url]', Spree.t(:attachment_url)
- = preference_field_tag 'preferences[attachment_url]', Spree::Config[:attachment_url], :type => :string
- .omega.four.columns
- .field{"data-hook" => "attachment_default_style"}
- = label_tag 'preferences[attachment_default_style]', Spree.t(:attachment_default_style)
- = collection_select 'preferences', 'attachment_default_style', @styles, :first, :first, {:selected => Spree::Config[:attachment_default_style] }, :class => 'select2 fullwidth'
- .clear
- .field{"data-hook" => "use_s3"}
- = preference_field_tag 'preferences[use_s3]', Spree::Config[:use_s3], :type => :boolean
- = label_tag 'preferences[use_s3]', Spree.t(:use_s3)
-
- %fieldset#attachment_styles.no-border-bottom{"data-hook" => "attachment_styles"}
- %legend{:align => "center"}= Spree.t(:attachment_styles)
- #styles_list.row.frameless
- - @styles.each_with_index do |(style_name, style_value), index|
- .field.three.columns
- = label_tag "attachment_styles[#{style_name}]", style_name
- %a.destroy_style{:alt => t(:destroy), :href => "#", :title => t(:destroy)}
- %i.icon-trash
- = text_field_tag "attachment_styles[#{style_name}][]", admin_image_settings_geometry_from_style(style_value), :class => 'fullwidth'
- %br/
- - current_format = admin_image_settings_format_from_style(style_value) || ''
- = select_tag "attachment_styles[#{style_name}][]", options_for_select(admin_image_settings_format_options, current_format), :class => 'fullwidth', :id => "attachment_styles_format_#{style_name}"
- #new-styles.row.frameless
- .field
- = link_to_with_icon 'icon-plus', Spree.t(:add_new_style), '#', :class => 'add_new_style button'
-
- .row
- #s3_settings.alpha.six.columns{"data-hook" => "s3_settings", :style => "display: none"}
- %fieldset.no-border-bottom
- %legend{:align => "center"}= Spree.t(:configure_s3)
- .field{"data-hook" => "s3_access_key"}
- = label_tag 'preferences[s3_access_key]', Spree.t(:s3_access_key)
- = preference_field_tag 'preferences[s3_access_key]', Spree::Config[:s3_access_key], :type => :string
- .field{"data-hook" => "s3_secret"}
- = label_tag 'preferences[s3_secret]', Spree.t(:s3_secret)
- = preference_field_tag 'preferences[s3_secret]', Spree::Config[:s3_secret], :type => :string
- .field{"data-hook" => "s3_bucket"}
- = label_tag 'preferences[s3_bucket]', Spree.t(:s3_bucket)
- = preference_field_tag 'preferences[s3_bucket]', Spree::Config[:s3_bucket], :type => :string
- .field{"data-hook" => "s3_protocol"}
- = label_tag 'preferences[s3_protocol]', Spree.t(:s3_protocol)
- = preference_field_tag 'preferences[s3_protocol]', Spree::Config[:s3_protocol], :type => :string
-
- #s3_headers.omega.six.columns{"data-hook" => "s3_headers", :style => "display: none"}
- %fieldset.no-border-bottom
- %legend{:align => "center"}= Spree.t(:s3_headers)
- #headers_list
- - @headers.each do |header_name, header_value|
- .field
- = label_tag "s3_headers[#{header_name}]", header_name
- %a.destroy_header.with-tip{:alt => destroy, :href => "#", :title => destroy}
- %i.icon-trash
- = text_field_tag "s3_headers[#{header_name}]", header_value, :class => 'fullwidth'
- = link_to_with_icon 'icon-plus', Spree.t(:add_new_header), '#', :class => 'add_header button'
-
- .form-buttons.filter-actions.actions{"data-hook" => "buttons"}
- = button Spree.t('actions.update'), 'icon-refresh'
diff --git a/app/views/spree/admin/shared/_configuration_menu.html.haml b/app/views/spree/admin/shared/_configuration_menu.html.haml
index c5f302f0db..3e5790beb5 100644
--- a/app/views/spree/admin/shared/_configuration_menu.html.haml
+++ b/app/views/spree/admin/shared/_configuration_menu.html.haml
@@ -7,7 +7,6 @@
= configurations_sidebar_menu_item Spree.t(:general_settings), edit_admin_general_settings_path
- if Spree::Config[:override_actionmailer_config]
= configurations_sidebar_menu_item Spree.t(:mail_method_settings), edit_admin_mail_methods_path
- = configurations_sidebar_menu_item Spree.t(:image_settings), edit_admin_image_settings_path
= configurations_sidebar_menu_item Spree.t(:tax_categories), admin_tax_categories_path
= configurations_sidebar_menu_item Spree.t(:tax_rates), admin_tax_rates_path
= configurations_sidebar_menu_item Spree.t(:tax_settings), edit_admin_tax_settings_path
diff --git a/app/views/spree/admin/shared/_tabs.html.haml b/app/views/spree/admin/shared/_tabs.html.haml
index e0134ee272..eb653c2500 100644
--- a/app/views/spree/admin/shared/_tabs.html.haml
+++ b/app/views/spree/admin/shared/_tabs.html.haml
@@ -3,7 +3,7 @@
= tab :order_cycles, url: main_app.admin_order_cycles_path, icon: 'icon-refresh'
= tab :orders, :subscriptions, :customer_details, :adjustments, :payments, :return_authorizations, url: admin_orders_path('q[s]' => 'completed_at desc'), icon: 'icon-shopping-cart'
= tab :reports, icon: 'icon-file'
-= tab :general_settings, :mail_methods, :image_settings, :tax_categories, :tax_rates, :tax_settings, :zones, :countries, :states, :payment_methods, :taxonomies, :shipping_methods, :shipping_categories, :enterprise_fees, :contents, :invoice_settings, :matomo_settings, :stripe_connect_settings, label: 'configuration', icon: 'icon-wrench', url: edit_admin_general_settings_path
+= tab :general_settings, :mail_methods, :tax_categories, :tax_rates, :tax_settings, :zones, :countries, :states, :payment_methods, :taxonomies, :shipping_methods, :shipping_categories, :enterprise_fees, :contents, :invoice_settings, :matomo_settings, :stripe_connect_settings, label: 'configuration', icon: 'icon-wrench', url: edit_admin_general_settings_path
= tab :enterprises, :enterprise_relationships, url: main_app.admin_enterprises_path
= tab :customers, url: main_app.admin_customers_path
= tab :enterprise_groups, url: main_app.admin_enterprise_groups_path, label: 'groups'
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 5979a77a97..362597e73d 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -3050,16 +3050,6 @@ See the %{link} to find out more about %{sitename}'s features and to start using
intercept_email_address: "Intercept Email Address"
intercept_email_instructions: "Override email recipient and replace with this address."
- image_settings: "Image Settings"
- image_settings_warning: "You will need to regenerate thumbnails if you update the paperclip styles. Use rake paperclip:refresh:thumbnails CLASS=Spree::Image to do this."
- attachment_default_style: Attachments Style
- attachment_default_url: "Attachments Default URL"
- attachment_path: "Attachments Path"
- attachment_styles: "Paperclip Styles"
- attachment_url: "Attachments URL"
- add_new_style: "Add New Style"
- image_settings_updated: "Image Settings successfully updated."
-
tax_categories: "Tax Categories"
listing_tax_categories: "Listing Tax Categories"
back_to_tax_categories_list: "Back To Tax Categories List"
diff --git a/config/routes/spree.rb b/config/routes/spree.rb
index 5aecadbf49..cb35c08cbc 100644
--- a/config/routes/spree.rb
+++ b/config/routes/spree.rb
@@ -134,8 +134,6 @@ Spree::Core::Engine.routes.draw do
post :testmail, :on => :collection
end
- resource :image_settings
-
resources :zones
resources :countries do
resources :states
diff --git a/knapsack_rspec_report.json b/knapsack_rspec_report.json
index f745a4438d..4324cbcf86 100644
--- a/knapsack_rspec_report.json
+++ b/knapsack_rspec_report.json
@@ -50,7 +50,6 @@
"spec/views/spree/admin/orders/edit.html.haml_spec.rb": 1.4470489025115967,
"spec/features/admin/configuration/tax_categories_spec.rb": 1.29876708984375,
"spec/serializers/api/cached_enterprise_serializer_spec.rb": 1.4465532302856445,
- "spec/features/admin/configuration/image_settings_spec.rb": 1.2370245456695557,
"spec/controllers/spree/admin/shipping_methods_controller_spec.rb": 1.7793538570404053,
"spec/services/cart_service_spec.rb": 3.899951696395874,
"spec/lib/open_food_network/orders_and_fulfillments_report/supplier_totals_report_spec.rb": 1.0069975852966309,
@@ -206,7 +205,6 @@
"spec/controllers/spree/credit_cards_controller_spec.rb": 0.3677220344543457,
"spec/controllers/api/customers_controller_spec.rb": 0.5009043216705322,
"spec/serializers/api/shipping_method_serializer_spec.rb": 0.418184757232666,
- "spec/features/admin/image_settings_spec.rb": 0.3251943588256836,
"spec/controllers/spree/admin/mail_methods_controller_spec.rb": 0.1681194305419922,
"spec/controllers/spree/paypal_controller_spec.rb": 0.3564426898956299,
"spec/mailers/user_mailer_spec.rb": 0.25026392936706543,
@@ -328,7 +326,6 @@
"spec/features/admin/external_services_spec.rb": 0.3893253803253174,
"spec/models/stock/package_spec.rb": 0.43047094345092773,
"spec/controllers/admin/stripe_connect_settings_controller_spec.rb": 0.27138352394104004,
- "spec/controllers/spree/admin/image_settings_controller_spec.rb": 0.2584362030029297,
"spec/features/consumer/confirm_invitation_spec.rb": 0.3224337100982666,
"spec/helpers/checkout_helper_spec.rb": 0.13036370277404785,
"spec/helpers/groups_helper_spec.rb": 0.012569427490234375,
diff --git a/spec/controllers/spree/admin/image_settings_controller_spec.rb b/spec/controllers/spree/admin/image_settings_controller_spec.rb
deleted file mode 100644
index 20bdd9dae0..0000000000
--- a/spec/controllers/spree/admin/image_settings_controller_spec.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Admin::ImageSettingsController do
- include AuthenticationHelper
-
- before { controller_login_as_admin }
-
- context "updating image settings" do
- it "should be able to update paperclip settings" do
- spree_put :update, preferences: { "attachment_path" => "foo/bar",
- "attachment_default_url" => "baz/bar" }
-
- expect(Spree::Config[:attachment_path]).to eq("foo/bar")
- expect(Spree::Config[:attachment_default_url]).to eq("baz/bar")
- end
-
- context "paperclip styles" do
- it "should be able to update the paperclip styles" do
- spree_put :update, "attachment_styles" => { "thumb" => "25x25>" }
- updated_styles = ActiveSupport::JSON.decode(Spree::Config[:attachment_styles])
- expect(updated_styles["thumb"]).to eq("25x25>")
- end
-
- it "should be able to add a new style" do
- spree_put :update, "attachment_styles" => {},
- "new_attachment_styles" => { "1" => { "name" => "jumbo",
- "value" => "2000x2000>" } }
- styles = ActiveSupport::JSON.decode(Spree::Config[:attachment_styles])
- expect(styles["jumbo"]).to eq("2000x2000>")
- end
- end
-
- context "amazon s3" do
- after(:all) do
- Spree::Image.attachment_definitions[:attachment].delete :storage
- end
-
- it "should be able to update s3 settings" do
- spree_put :update, preferences:
- {
- "use_s3" => "1",
- "s3_access_key" => "a_valid_key",
- "s3_secret" => "a_secret",
- "s3_bucket" => "some_bucket"
- }
- expect(Spree::Config[:use_s3]).to be_truthy
- expect(Spree::Config[:s3_access_key]).to eq("a_valid_key")
- expect(Spree::Config[:s3_secret]).to eq("a_secret")
- expect(Spree::Config[:s3_bucket]).to eq("some_bucket")
- end
-
- context "headers" do
- before(:each) { Spree::Config[:use_s3] = true }
-
- it "should be able to update the s3 headers" do
- spree_put :update, "preferences" => { "use_s3" => "1" },
- "s3_headers" => { "Cache-Control" => "max-age=1111" }
- headers = ActiveSupport::JSON.decode(Spree::Config[:s3_headers])
- expect(headers["Cache-Control"]).to eq("max-age=1111")
- end
-
- it "should be able to add a new header" do
- spree_put :update, "s3_headers" => {},
- "new_s3_headers" => { "1" => { "name" => "Charset",
- "value" => "utf-8" } }
- headers = ActiveSupport::JSON.decode(Spree::Config[:s3_headers])
- expect(headers["Charset"]).to eq("utf-8")
- end
- end
- end
- end
-end
diff --git a/spec/features/admin/configuration/image_settings_spec.rb b/spec/features/admin/configuration/image_settings_spec.rb
deleted file mode 100644
index 5c87e8e6ad..0000000000
--- a/spec/features/admin/configuration/image_settings_spec.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-require 'spec_helper'
-
-describe "image settings" do
- include AuthenticationHelper
-
- before do
- login_as_admin_and_visit spree.admin_dashboard_path
- click_link "Configuration"
- click_link "Image Settings"
- end
-
- # Regression test for #2344
- it "can update attachment_url" do
- fill_in "Attachments URL", with: "foobar"
- fill_in "Attachments Default URL", with: "barfoo"
- fill_in "Attachments Path", with: "spec/dummy/tmp/bfaoro"
- click_button "Update"
-
- expect(Spree::Config[:attachment_url]).to eq("foobar")
- expect(Spree::Config[:attachment_default_url]).to eq("barfoo")
- expect(Spree::Config[:attachment_path]).to eq("spec/dummy/tmp/bfaoro")
- end
-
- # Regression test for #3069
- context "updates style configs and uploads products" do
- let!(:product) { create(:product) }
- let(:file_path) { Rails.root + "spec/support/fixtures/thinking-cat.jpg" }
-
- it "still uploads image gracefully" do
- click_button "Update"
-
- visit spree.new_admin_product_image_path(product)
- attach_file('image_attachment', file_path)
- expect {
- click_on "Update"
- }.to_not raise_error
- end
- end
-end
diff --git a/spec/features/admin/image_settings_spec.rb b/spec/features/admin/image_settings_spec.rb
deleted file mode 100644
index 83e584a0ce..0000000000
--- a/spec/features/admin/image_settings_spec.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-require 'spec_helper'
-
-feature '
- As an admin
- I want to manage image formats
-' do
- include AuthenticationHelper
- include WebHelper
-
- before(:all) do
- styles = { "mini" => "48x48>",
- "small" => "100x100>",
- "product" => "240x240>",
- "large" => "600x600>" }
-
- Spree::Config[:attachment_styles] = ActiveSupport::JSON.encode(styles)
- Spree::Image.attachment_definitions[:attachment][:styles] = ActiveSupport::JSON.decode(Spree::Config[:attachment_styles])
- Spree::Image.reformat_styles
- end
-
- scenario "setting the image format for a paperclip style" do
- # When I go to the image settings page
- login_as_admin_and_visit spree.edit_admin_image_settings_path
-
- # All the styles should default to "Unchanged"
- expect(page).to have_select 'attachment_styles_format_mini', selected: 'Unchanged'
- expect(page).to have_select 'attachment_styles_format_small', selected: 'Unchanged'
- expect(page).to have_select 'attachment_styles_format_product', selected: 'Unchanged'
- expect(page).to have_select 'attachment_styles_format_large', selected: 'Unchanged'
-
- # When I change a style to "PNG" and save
- select 'PNG', from: 'attachment_styles_format_mini'
- click_button 'Update'
-
- # Then the change should be saved to the image formats
- expect(page).to have_content "Image Settings successfully updated."
- expect(page).to have_select 'attachment_styles_format_mini', selected: 'PNG'
-
- styles = Spree::Image.attachment_definitions[:attachment][:styles]
- expect(styles[:mini]).to eq(['48x48>', :png])
- end
-end
diff --git a/spec/models/spree/image_spec.rb b/spec/models/spree/image_spec.rb
deleted file mode 100644
index 1ad60cbe57..0000000000
--- a/spec/models/spree/image_spec.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require 'spec_helper'
-
-module Spree
- describe Image do
- describe "attachment definitions" do
- let(:name_str) { { "mini" => "48x48>" } }
- let(:formatted) { { mini: ["48x48>", "png"] } }
-
- it "converts style names to symbols" do
- expect(Image.format_styles(name_str)).to eq(mini: "48x48>")
- end
-
- it "converts formats to symbols" do
- expect(Image.format_styles(formatted)).to eq(mini: ["48x48>", :png])
- end
- end
- end
-end