retina_rails 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca5a50c307c9f07f0c43faf40cf993b2e11b7943
4
- data.tar.gz: 8a421d0bfe4c2a56edc9bcf125995510c1888dc2
3
+ metadata.gz: 3c0460e350f4f6ca0e30e636d2852e48c7e427e7
4
+ data.tar.gz: 7b5eba9c1dd3c5004db9646bef6eab5a1bcf7936
5
5
  SHA512:
6
- metadata.gz: b2fe87a9fad43534abdb6d027b25e26d26f2c72d6a423e43ad28593c28ab9f8aa78f5f8f0ee61fd5eff88f0259e29af68d38eeffbc0ce0f9cf826d1a2da28b39
7
- data.tar.gz: a7cb72e4f38cf76b7090c741b04d1aeb00bd73817a5e86ad6e2c01fb1cad51f4ca5aeccdc5d90a63bc7904dd02ce243c924e40ec2e31a6a9d2b0697eedef2bf2
6
+ metadata.gz: 0ad3514926e9aa320311bfc25dd1d1d742f6a8d03f50593493f7aff322389f131f5ff452cf10296c7e4e69eb2a1dcf115a240ed3b81c93991e78b6257fde4bff
7
+ data.tar.gz: aa46aedbb24c9197645eb88886b2737d3896b356267eb0383ac602cb06b17355deaebe381c67675aec98f1ebf02c8c26e696925567113bfe1c64bae4ac34f58f
@@ -1,20 +1,24 @@
1
+ bundler_args: "--jobs 4 --retry 3"
2
+ cache: bundler
1
3
  language: ruby
4
+ sudo: false
2
5
  rvm:
3
- - 1.9.2
4
6
  - 1.9.3
5
7
  - 2.0.0
6
- - 2.1.1
7
- - 2.1.3
8
+ - 2.1.7
9
+ - 2.2.3
8
10
  - ruby-head
9
11
 
10
12
  env:
11
- - "RAILS_VERSION=3.1.0"
12
- - "RAILS_VERSION=3.2.0"
13
- - "RAILS_VERSION=4.0.0"
14
- - "RAILS_VERSION=4.1.0"
13
+ - "RAILS_VERSION=3.1.12"
14
+ - "RAILS_VERSION=3.2.22"
15
+ - "RAILS_VERSION=4.0.13"
16
+ - "RAILS_VERSION=4.1.14"
17
+ - "RAILS_VERSION=4.2.5"
15
18
  - "RAILS_VERSION=master"
16
19
 
17
20
  matrix:
18
21
  allow_failures:
19
22
  - env: "RAILS_VERSION=master"
20
23
  - rvm: ruby-head
24
+ fast_finish: true
@@ -65,7 +65,11 @@ module RetinaRails
65
65
  config = versions[name]
66
66
  options[:retina] = false
67
67
 
68
- processors = config[:uploader].processors.dup
68
+ processors = if config.respond_to?(:processors)
69
+ config.processors.dup
70
+ else
71
+ config[:uploader].processors.dup
72
+ end
69
73
  dimensions_processor = nil
70
74
 
71
75
  ## Check if there's a resize processor to get the dimensions
@@ -86,7 +90,11 @@ module RetinaRails
86
90
  dimensions.insert(0, width)
87
91
 
88
92
  ## Reset the processors
89
- versions[name][:uploader].processors = []
93
+ if config.respond_to?(:processors)
94
+ config.processors = []
95
+ else
96
+ config[:uploader].processors = []
97
+ end
90
98
 
91
99
  ## Override version with double height and width
92
100
  version name, options do
@@ -1,3 +1,3 @@
1
1
  module RetinaRails
2
- VERSION = "2.0.3"
2
+ VERSION = "2.0.4"
3
3
  end
@@ -19,20 +19,15 @@ Gem::Specification.new do |gem|
19
19
  gem.require_paths = ['lib']
20
20
 
21
21
  gem.add_development_dependency 'bundler', '>= 1.0.0'
22
- gem.add_development_dependency 'rake'
23
- gem.add_development_dependency 'rspec', '>= 2.3'
24
- gem.add_development_dependency 'rspec-rails', '~> 2.0'
22
+ gem.add_development_dependency 'coveralls'
25
23
  gem.add_development_dependency 'carrierwave'
26
24
  gem.add_development_dependency 'paperclip'
25
+ gem.add_development_dependency 'rake'
26
+ gem.add_development_dependency 'rspec-rails', '~> 3.4'
27
27
  gem.add_development_dependency 'rmagick'
28
28
  gem.add_development_dependency 'sqlite3'
29
- gem.add_development_dependency 'coveralls'
30
29
 
31
- if RUBY_VERSION > '1.9.2'
32
- gem.add_dependency 'rails', '>= 3.2.0'
33
- else
34
- gem.add_dependency 'rails', '>= 3.2.0', '< 4.0.0'
35
- end
30
+ gem.add_dependency 'rails', '>= 3.2.0'
36
31
 
37
32
  if File.exists?('UPGRADING')
38
33
  gem.post_install_message = File.read("UPGRADING")
@@ -40,50 +40,58 @@ describe ActionView::Helpers::AssetTagHelper, :type => :helper do
40
40
  it 'should set correct width and height' do
41
41
  image = helper.retina_image_tag(Upload.new, :avatar, :small)
42
42
 
43
- image.should include('width="40"')
44
- image.should include('height="30"')
43
+ expect(image).to include('width="40"')
44
+ expect(image).to include('height="30"')
45
45
  end
46
46
 
47
47
  it 'should be able to add a class' do
48
48
  image = helper.retina_image_tag(Upload.new, :avatar, :small, :class => 'foo')
49
- image.should include('class="foo"')
49
+ expect(image).to include('class="foo"')
50
50
  end
51
51
 
52
52
  end
53
53
 
54
54
  context 'without dimensions present' do
55
55
 
56
- before(:each) { Upload.any_instance.stub(:retina_dimensions).and_return(nil) }
56
+ before(:each) do
57
+ allow_any_instance_of(Upload).to receive(:retina_dimensions).and_return(nil)
58
+ end
57
59
 
58
60
  it 'should set correct width and height' do
59
61
  image = helper.retina_image_tag(Upload.new, :avatar, :small, :default => { :width => 25, :height => 40 })
60
62
 
61
- image.should include('width="25"')
62
- image.should include('height="40"')
63
+ expect(image).to include('width="25"')
64
+ expect(image).to include('height="40"')
63
65
 
64
66
  image = helper.retina_image_tag(Upload.new, :avatar, :small, :default => [25, 40])
65
67
 
66
- image.should include('width="25"')
67
- image.should include('height="40"')
68
+ expect(image).to include('width="25"')
69
+ expect(image).to include('height="40"')
68
70
  end
69
71
 
70
72
  it 'should set no height and width if no defaults present' do
71
73
  image = helper.retina_image_tag(Upload.new, :avatar, :small)
72
74
 
73
- image.should_not include('width')
74
- image.should_not include('height')
75
+ expect(image).to_not include('width')
76
+ expect(image).to_not include('height')
75
77
  end
76
78
 
77
79
  it 'should be able to add a class' do
78
80
  image = helper.retina_image_tag(Upload.new, :avatar, :small, :default => { :width => 25, :height => 40 }, :class => 'foo')
79
81
 
80
- image.should include('class="foo"')
82
+ expect(image).to include('class="foo"')
81
83
  end
82
84
 
83
85
  it 'should strip default attributes' do
84
86
  image = helper.retina_image_tag(Upload.new, :avatar, :small, :default => { :width => 25, :height => 40 })
85
87
 
86
- image.should_not include('default')
88
+ expect(image).to_not include('default')
89
+ end
90
+
91
+ it 'should respect other options' do
92
+ image = helper.retina_image_tag(Upload.new, :avatar, :small, :default => { :width => 25, :height => 40 }, :alt => 'Some alt tag')
93
+
94
+ expect(image).to include('alt="Some alt tag"')
87
95
  end
88
96
 
89
97
  end
@@ -93,14 +101,14 @@ describe ActionView::Helpers::AssetTagHelper, :type => :helper do
93
101
  describe '#image_tag' do
94
102
 
95
103
  it 'should show a deprecation warning when used with retina option' do
96
- ActiveSupport::Deprecation.should_receive(:warn)
104
+ expect(ActiveSupport::Deprecation).to receive(:warn)
97
105
  .with("`image_tag('image.png', :retina => true)` is deprecated use `retina_image_tag` instead")
98
106
 
99
107
  image_tag('image.png', :retina => true)
100
108
  end
101
109
 
102
110
  it 'should not show a deprecation warning when used without retina option' do
103
- ActiveSupport::Deprecation.should_not_receive(:warn)
111
+ expect(ActiveSupport::Deprecation).to_not receive(:warn)
104
112
  .with("`image_tag('image.png', :retina => true)` is deprecated use `retina_image_tag` instead")
105
113
 
106
114
  image_tag('image.png')
@@ -108,4 +116,4 @@ describe ActionView::Helpers::AssetTagHelper, :type => :helper do
108
116
 
109
117
  end
110
118
 
111
- end
119
+ end
@@ -17,6 +17,7 @@ require 'carrierwave'
17
17
  require 'paperclip'
18
18
  require "paperclip/railtie"
19
19
  Paperclip::Railtie.insert
20
+ Paperclip.options[:log] = false unless ENV["LOG_PAPERCLIP"]
20
21
 
21
22
  ## Setup fixture database for activerecord
22
23
 
@@ -19,7 +19,14 @@ describe RetinaRails::Strategies::CarrierWave do
19
19
  after(:each) do
20
20
  AnonymousUploader.enable_processing = false
21
21
  @uploader.remove!
22
- AnonymousUploader.versions[:small][:uploader].processors = [] ## Reset processors
22
+
23
+ ## Reset processors
24
+ version = AnonymousUploader.versions[:small]
25
+ if version.respond_to?(:processors)
26
+ version.processors = []
27
+ else
28
+ version[:uploader].processors = []
29
+ end
23
30
  end
24
31
 
25
32
  ##
@@ -40,16 +47,16 @@ describe RetinaRails::Strategies::CarrierWave do
40
47
  end
41
48
 
42
49
  it 'should double the height and width of an image' do
43
- @uploader.small.should have_dimensions(60, 80)
50
+ expect(@uploader.small).to have_dimensions(60, 80)
44
51
  end
45
52
 
46
53
  it 'should store original width and height attributes for version' do
47
- @uploader.model.retina_dimensions[:avatar][:small].should == { :width => 30, :height => 40 }
54
+ expect(@uploader.model.retina_dimensions[:avatar][:small]).to eq({ :width => 30, :height => 40 })
48
55
  end
49
56
 
50
57
  it "should set quality to it's default 60%" do
51
58
  quality = Magick::Image.read(@uploader.small.current_path).first.quality
52
- quality.should == 60
59
+ expect(quality).to eq(60)
53
60
  end
54
61
 
55
62
  end
@@ -71,11 +78,11 @@ describe RetinaRails::Strategies::CarrierWave do
71
78
  it "should override quality" do
72
79
  upload!
73
80
  quality = Magick::Image.read(@uploader.small.current_path).first.quality
74
- quality.should == 80
81
+ expect(quality).to eq 80
75
82
  end
76
83
 
77
84
  it 'should receive quality processor once' do
78
- AnonymousUploader.any_instance.should_receive(:retina_quality).once
85
+ expect_any_instance_of(AnonymousUploader).to receive(:retina_quality).once
79
86
 
80
87
  upload!
81
88
  end
@@ -105,11 +112,11 @@ describe RetinaRails::Strategies::CarrierWave do
105
112
  end
106
113
 
107
114
  it 'should double the height and width of an image' do
108
- @uploader.small.should have_dimensions(60, 80)
115
+ expect(@uploader.small).to have_dimensions(60, 80)
109
116
  end
110
117
 
111
118
  it 'should store original width and height attributes for version' do
112
- @uploader.model.retina_dimensions[:avatar][:small].should == { :width => 30, :height => 40 }
119
+ expect(@uploader.model.retina_dimensions[:avatar][:small]).to eq({ :width => 30, :height => 40 })
113
120
  end
114
121
 
115
122
  end
@@ -137,11 +144,11 @@ describe RetinaRails::Strategies::CarrierWave do
137
144
  end
138
145
 
139
146
  it 'should double the height and width of an image' do
140
- @uploader.small.should have_dimensions(200, 200)
147
+ expect(@uploader.small).to have_dimensions(200, 200)
141
148
  end
142
149
 
143
150
  it 'should store original width and height attributes for version' do
144
- @uploader.model.retina_dimensions[:avatar][:small].should == { :width => 100, :height => 100 }
151
+ expect(@uploader.model.retina_dimensions[:avatar][:small]).to eq({ :width => 100, :height => 100 })
145
152
  end
146
153
 
147
154
  end
@@ -162,8 +169,8 @@ describe RetinaRails::Strategies::CarrierWave do
162
169
  end
163
170
 
164
171
  it 'should not create a version' do
165
- @uploader.version_exists?(:small_conditional).should be_false
166
- @uploader.small_conditional.current_path.should_not be_present
172
+ expect(@uploader.version_exists?(:small_conditional)).to eq(false)
173
+ expect(@uploader.small_conditional.current_path).to_not be_present
167
174
  end
168
175
 
169
176
  end
@@ -38,16 +38,16 @@ describe RetinaRails::Strategies::Paperclip do
38
38
  end
39
39
 
40
40
  it 'should double the height and width of an image' do
41
- Paperclip::Geometry.from_file(image_path).to_s.should == '60x80'
41
+ expect(Paperclip::Geometry.from_file(image_path).to_s).to eq('60x80')
42
42
  end
43
43
 
44
44
  it 'should store original width and height attributes for version' do
45
- @upload.retina_dimensions[:avatar][:big].should == { :width => 30, :height => 40 }
45
+ expect(@upload.retina_dimensions[:avatar][:big]).to eq({ :width => 30, :height => 40 })
46
46
  end
47
47
 
48
48
  it "should set quality to it's default 60%" do
49
49
  quality = Magick::Image.read(image_path).first.quality
50
- quality.should == 60
50
+ expect(quality).to eq(60)
51
51
  end
52
52
 
53
53
  end
@@ -75,16 +75,16 @@ describe RetinaRails::Strategies::Paperclip do
75
75
  end
76
76
 
77
77
  it 'should double the height and width of an image' do
78
- Paperclip::Geometry.from_file(image_path).to_s.should == '60x80'
78
+ expect(Paperclip::Geometry.from_file(image_path).to_s).to eq('60x80')
79
79
  end
80
80
 
81
81
  it 'should store original width and height attributes for version' do
82
- @upload.retina_dimensions[:avatar][:big].should == { :width => 30, :height => 40 }
82
+ expect(@upload.retina_dimensions[:avatar][:big]).to eq({ :width => 30, :height => 40 })
83
83
  end
84
84
 
85
85
  it "should set quality to it's default 60%" do
86
86
  quality = Magick::Image.read(image_path).first.quality
87
- quality.should == 60
87
+ expect(quality).to eq(60)
88
88
  end
89
89
 
90
90
  end
@@ -103,16 +103,16 @@ describe RetinaRails::Strategies::Paperclip do
103
103
  end
104
104
 
105
105
  it 'should double the height and width of an image' do
106
- Paperclip::Geometry.from_file(image_path).to_s.should == '1600x1600'
106
+ expect(Paperclip::Geometry.from_file(image_path).to_s).to eq('1600x1600')
107
107
  end
108
108
 
109
109
  it 'should store original width and height attributes for version' do
110
- @upload.retina_dimensions[:avatar][:big].should == { :width => 800, :height => 800 }
110
+ expect(@upload.retina_dimensions[:avatar][:big]).to eq({ :width => 800, :height => 800 })
111
111
  end
112
112
 
113
113
  it "should set quality to it's default 60%" do
114
114
  quality = Magick::Image.read(image_path).first.quality
115
- quality.should == 60
115
+ expect(quality).to eq(60)
116
116
  end
117
117
 
118
118
  end
@@ -133,7 +133,7 @@ describe RetinaRails::Strategies::Paperclip do
133
133
 
134
134
  it "should set quality" do
135
135
  quality = Magick::Image.read(image_path).first.quality
136
- quality.should == 25
136
+ expect(quality).to eq(25)
137
137
  end
138
138
 
139
139
  end
@@ -7,10 +7,12 @@ module RetinaRailsTest
7
7
  config.active_support.deprecation = :log
8
8
 
9
9
  if Rails::VERSION::STRING >= "4.0.0"
10
+ config.eager_load = false
10
11
  config.secret_token = 'existing secret token'
11
12
  config.secret_key_base = 'new secret key base'
12
13
  end
13
14
 
14
15
  end
15
16
  end
16
- RetinaRailsTest::Application.initialize!
17
+
18
+ RetinaRailsTest::Application.initialize!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retina_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan van Zonneveld
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-18 00:00:00.000000000 Z
12
+ date: 2015-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -26,7 +26,7 @@ dependencies:
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.0.0
28
28
  - !ruby/object:Gem::Dependency
29
- name: rake
29
+ name: coveralls
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
@@ -40,35 +40,21 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: rspec
43
+ name: carrierwave
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '2.3'
48
+ version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: '2.3'
56
- - !ruby/object:Gem::Dependency
57
- name: rspec-rails
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '2.0'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '2.0'
55
+ version: '0'
70
56
  - !ruby/object:Gem::Dependency
71
- name: carrierwave
57
+ name: paperclip
72
58
  requirement: !ruby/object:Gem::Requirement
73
59
  requirements:
74
60
  - - ">="
@@ -82,7 +68,7 @@ dependencies:
82
68
  - !ruby/object:Gem::Version
83
69
  version: '0'
84
70
  - !ruby/object:Gem::Dependency
85
- name: paperclip
71
+ name: rake
86
72
  requirement: !ruby/object:Gem::Requirement
87
73
  requirements:
88
74
  - - ">="
@@ -96,21 +82,21 @@ dependencies:
96
82
  - !ruby/object:Gem::Version
97
83
  version: '0'
98
84
  - !ruby/object:Gem::Dependency
99
- name: rmagick
85
+ name: rspec-rails
100
86
  requirement: !ruby/object:Gem::Requirement
101
87
  requirements:
102
- - - ">="
88
+ - - "~>"
103
89
  - !ruby/object:Gem::Version
104
- version: '0'
90
+ version: '3.4'
105
91
  type: :development
106
92
  prerelease: false
107
93
  version_requirements: !ruby/object:Gem::Requirement
108
94
  requirements:
109
- - - ">="
95
+ - - "~>"
110
96
  - !ruby/object:Gem::Version
111
- version: '0'
97
+ version: '3.4'
112
98
  - !ruby/object:Gem::Dependency
113
- name: sqlite3
99
+ name: rmagick
114
100
  requirement: !ruby/object:Gem::Requirement
115
101
  requirements:
116
102
  - - ">="
@@ -124,7 +110,7 @@ dependencies:
124
110
  - !ruby/object:Gem::Version
125
111
  version: '0'
126
112
  - !ruby/object:Gem::Dependency
127
- name: coveralls
113
+ name: sqlite3
128
114
  requirement: !ruby/object:Gem::Requirement
129
115
  requirements:
130
116
  - - ">="