Fix more rubocop issues in image_settings_controller_spec

This commit is contained in:
luisramos0
2019-09-17 18:03:47 +01:00
parent 05d24cf11a
commit 495de37620

View File

@@ -7,7 +7,8 @@ describe Spree::Admin::ImageSettingsController do
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" }
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")
@@ -21,7 +22,9 @@ describe Spree::Admin::ImageSettingsController do
end
it "should be able to add a new style" do
spree_put :update, "attachment_styles" => {}, "new_attachment_styles" => { "1" => { "name" => "jumbo", "value" => "2000x2000>" } }
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
@@ -50,13 +53,16 @@ describe Spree::Admin::ImageSettingsController 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" }
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" } }
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