-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1021 from texpert/fix-comment-in-system-json
Fix comment in config/system.json to avoid Oj exception on parsing
- Loading branch information
Showing
10 changed files
with
49 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,60 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
describe CamaleonCms::UploaderHelper do | ||
init_site | ||
before(:each) do | ||
@path = "#{CAMALEON_CMS_ROOT}/spec/support/fixtures/rails_tmp.png" | ||
FileUtils.cp("#{CAMALEON_CMS_ROOT}/spec/support/fixtures/rails.png", @path) | ||
end | ||
it "upload a local file" do | ||
|
||
it 'upload a local file' do | ||
expect(upload_file(File.open(@path)).keys.include?(:error)).not_to eql(true) | ||
expect(upload_file(File.open(@path), {thumb_size: '20x20'}).keys.include?(:error)).not_to eql(true) | ||
expect(upload_file(File.open(@path), {folder: 'sample'}).keys.include?(:error)).not_to eql(true) | ||
end | ||
it "upload a local file max size" do | ||
|
||
it 'upload a local file max size' do | ||
expect(upload_file(File.open(@path), {maximum: 1.byte}).keys.include?(:error)).to eql(true) | ||
end | ||
|
||
it "upload a local file custom dimension" do | ||
it 'upload a local file custom dimension' do | ||
expect(upload_file(File.open(@path), {dimension: '50x50'}).keys.include?(:error)).not_to eql(true) | ||
expect(upload_file(File.open(@path), {dimension: 'x50'}).keys.include?(:error)).not_to eql(true) | ||
expect(upload_file(File.open(@path), {dimension: '50x'}).keys.include?(:error)).not_to eql(true) | ||
expect(upload_file(File.open(@path), {dimension: '50x20?'}).keys.include?(:error)).not_to eql(true) | ||
end | ||
|
||
it "upload a local file invalid format" do | ||
it 'upload a local file invalid format' do | ||
expect(upload_file(File.open(@path), {formats: 'audio'}).keys.include?(:error)).to eql(true) | ||
end | ||
|
||
it "upload a local file with versions" do | ||
it 'upload a local file with versions' do | ||
expect(upload_file(File.open(@path), {versions: '300x300,505x350,20x'}).keys.include?(:error)).not_to eql(true) | ||
end | ||
it "add auto orient for cropping images" do | ||
callback = lambda do |params| | ||
params[:img] = params[:img].auto_orient | ||
|
||
it 'add auto orient for cropping images' do | ||
callback = lambda do |params| | ||
params[:img] = params[:img].auto_orient | ||
end | ||
PluginRoutes.add_anonymous_hook('before_crop_image', callback, 'my_custom_hook') | ||
expect(upload_file(File.open(@path), {versions: '300x300,505x350,20x'}).keys.include?(:error)).not_to eql(true) | ||
PluginRoutes.remove_anonymous_hook('before_crop_image','my_custom_hook') | ||
end | ||
it "add auto orient for resizing" do | ||
|
||
it 'add auto orient for resizing' do | ||
callback = lambda do |params| | ||
params[:img] = params[:img].auto_orient | ||
params[:img] = params[:img].auto_orient | ||
end | ||
PluginRoutes.add_anonymous_hook('before_resize_crop', callback, 'my_custom_hook') | ||
expect(upload_file(File.open(@path), {versions: '300x300,505x350,20x'}).keys.include?(:error)).not_to eql(true) | ||
PluginRoutes.remove_anonymous_hook('before_resize_crop','my_custom_hook') | ||
end | ||
|
||
it "upload a external file" do | ||
expect(upload_file('http://camaleon.tuzitio.com/media/132/slider/slide33.jpg').keys.include?(:error)).not_to eql(true) | ||
end | ||
|
||
end | ||
it 'upload a external file' do | ||
expect( | ||
upload_file('https://upload.wikimedia.org/wikipedia/commons/1/15/Jpegvergroessert.jpg').keys.include?(:error) | ||
).not_to eql(true) | ||
end | ||
end |