mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Transpec image_setting_controller_spec
This commit is contained in:
@@ -9,21 +9,21 @@ describe Spree::Admin::ImageSettingsController do
|
||||
it "should be able to update paperclip settings" do
|
||||
spree_put :update, preferences: { "attachment_path" => "foo/bar", "attachment_default_url" => "baz/bar" }
|
||||
|
||||
Spree::Config[:attachment_path].should == "foo/bar"
|
||||
Spree::Config[:attachment_default_url].should == "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])
|
||||
updated_styles["thumb"].should == "25x25>"
|
||||
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])
|
||||
styles["jumbo"].should == "2000x2000>"
|
||||
expect(styles["jumbo"]).to eq("2000x2000>")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -40,10 +40,10 @@ describe Spree::Admin::ImageSettingsController do
|
||||
"s3_secret" => "a_secret",
|
||||
"s3_bucket" => "some_bucket"
|
||||
}
|
||||
Spree::Config[:use_s3].should be_truthy
|
||||
Spree::Config[:s3_access_key].should == "a_valid_key"
|
||||
Spree::Config[:s3_secret].should == "a_secret"
|
||||
Spree::Config[:s3_bucket].should == "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
|
||||
@@ -52,13 +52,13 @@ describe Spree::Admin::ImageSettingsController do
|
||||
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])
|
||||
headers["Cache-Control"].should == "max-age=1111"
|
||||
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])
|
||||
headers["Charset"].should == "utf-8"
|
||||
expect(headers["Charset"]).to eq("utf-8")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user