light_resizer 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +13 -1
- data/README.md +2 -12
- data/lib/light_resizer.rb +14 -2
- data/lib/light_resizer/carrierwave_resize.rb +5 -18
- data/lib/light_resizer/dimension_not_found.rb +6 -0
- data/lib/light_resizer/middleware.rb +10 -34
- data/lib/light_resizer/resizer.rb +72 -0
- data/lib/light_resizer/version.rb +2 -2
- data/light_resizer.gemspec +5 -8
- data/spec/dummy/.gitignore +17 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +16 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/uploaders/photo_uploader.rb +5 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +19 -0
- data/spec/dummy/config/boot.rb +3 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +38 -0
- data/spec/dummy/config/environments/production.rb +74 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +56 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/seeds.rb +7 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/lib/tasks/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/dummy/public/uploads/test/.gitignore +1 -0
- data/spec/dummy/public/uploads/test/dragon.jpg +0 -0
- data/spec/features/carrier_wave_resize_spec.rb +20 -0
- data/spec/features/middleware_spec.rb +82 -0
- data/spec/spec_helper.rb +16 -5
- metadata +116 -79
- data/lib/light_resizer/image_loader.rb +0 -48
- data/lib/light_resizer/image_loader/original_image.rb +0 -39
- data/lib/light_resizer/image_loader/resize_image.rb +0 -51
- data/lib/light_resizer/middleware/path.rb +0 -71
- data/lib/light_resizer/middleware/resizer.rb +0 -45
- data/spec/fixtures/sample.jpg +0 -0
- data/spec/integration/middleware_spec.rb +0 -37
- data/spec/unit/image_loader_original_spec.rb +0 -29
- data/spec/unit/image_loader_resized_spec.rb +0 -45
- data/spec/unit/image_loader_spec.rb +0 -23
- data/spec/unit/middleware_path_spec.rb +0 -53
- data/spec/unit/middleware_resizer_spec.rb +0 -35
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe LightResizer::Middleware::Resizer do
|
4
|
-
|
5
|
-
let(:resizer) { described_class.new }
|
6
|
-
let(:image_path) { File.join(ROOT, 'fixtures', 'sample') }
|
7
|
-
let(:resize_image_path) { File.join(ROOT, 'fixtures', 'light_resize', image_name) }
|
8
|
-
|
9
|
-
context 'resize' do
|
10
|
-
|
11
|
-
after do
|
12
|
-
File.delete( resize_image_path + '.png' )
|
13
|
-
end
|
14
|
-
|
15
|
-
context 'without crop' do
|
16
|
-
let(:image_name) { '50x50_sample' }
|
17
|
-
|
18
|
-
it 'should create resized image file' do
|
19
|
-
resizer.resize('50x50', image_path, resize_image_path, false, '.png', true)
|
20
|
-
expect(File.exist?(resize_image_path+'.png')).to eq(true)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'with crop' do
|
25
|
-
let(:image_name) { '50x50_crop_convert_sample' }
|
26
|
-
|
27
|
-
it 'should create resized image file' do
|
28
|
-
resizer.resize('50x50', image_path, resize_image_path, true, '.png', true)
|
29
|
-
expect(File.exist?(resize_image_path+'.png')).to eq(true)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|