paperclip 4.3.0 → 4.3.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of paperclip might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +3 -6
- data/Appraisals +0 -3
- data/NEWS +10 -1
- data/README.md +9 -7
- data/features/step_definitions/attachment_steps.rb +20 -20
- data/features/step_definitions/html_steps.rb +2 -2
- data/features/step_definitions/rails_steps.rb +11 -11
- data/features/step_definitions/web_steps.rb +1 -103
- data/features/support/file_helpers.rb +2 -2
- data/gemfiles/3.2.gemfile +1 -2
- data/gemfiles/4.1.gemfile +0 -1
- data/gemfiles/4.2.gemfile +0 -1
- data/lib/paperclip/attachment.rb +0 -2
- data/lib/paperclip/geometry_parser_factory.rb +1 -1
- data/lib/paperclip/glue.rb +1 -1
- data/lib/paperclip/schema.rb +1 -1
- data/lib/paperclip/version.rb +1 -1
- data/paperclip.gemspec +1 -1
- data/spec/paperclip/attachment_spec.rb +3 -4
- data/spec/paperclip/geometry_spec.rb +1 -1
- data/spec/paperclip/glue_spec.rb +44 -0
- data/spec/spec_helper.rb +3 -0
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab079cc4a5b7fb2885b1976726ae33c0db4f675c
|
4
|
+
data.tar.gz: 9702e32a54d7bb860cf80378d9a2272414d4a6bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 907a4cb680acec3e2900bc2bc2b3ec800850f6d1819feaff1f7fcc4104e665571ec330fe78606152ea35fcbcd653163f00dd22585d230ab7d2da228984abc9f1
|
7
|
+
data.tar.gz: 197e5d325aa36649e725672ff64dcf127944c97cb91d69faed664cd05dc32d643dea1a65eadb917493d9883009fb79e06f5ae27a001b130cb5525827026de370
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
appraise "3.2" do
|
2
2
|
gem "rails", "~> 3.2.0"
|
3
|
-
gem "paperclip", :path => "../"
|
4
3
|
end
|
5
4
|
|
6
5
|
appraise "4.1" do
|
7
6
|
gem "rails", "~> 4.1.0"
|
8
|
-
gem "paperclip", :path => "../"
|
9
7
|
end
|
10
8
|
|
11
9
|
appraise "4.2" do
|
12
10
|
gem "rails", "~> 4.2.0"
|
13
|
-
gem "paperclip", :path => "../"
|
14
11
|
end
|
data/NEWS
CHANGED
@@ -1,4 +1,13 @@
|
|
1
|
-
4.3.
|
1
|
+
4.3.1 (9/9/2015):
|
2
|
+
|
3
|
+
* Backport of bugfix to `remove_column`, so it works in Rails 3 and 4
|
4
|
+
c740fb171fe2f88c60b999d2a1c2122f2b8f43e9
|
5
|
+
* Fix GeometryParser regex for usage of '@>' flag
|
6
|
+
* `url` on a unpersisted record returns default_url
|
7
|
+
* spec deprecation warnings and failures
|
8
|
+
* README adjustments
|
9
|
+
|
10
|
+
4.3.0 (6/18/2015):
|
2
11
|
|
3
12
|
* Improvement: Update aws-sdk and cucumber gem versions.
|
4
13
|
* Improvement: Add `length` alias for `size` method in AbstractAdapter.
|
data/README.md
CHANGED
@@ -95,6 +95,14 @@ to install GhostScript. On Mac OS X, you can also install that using Homebrew:
|
|
95
95
|
|
96
96
|
brew install gs
|
97
97
|
|
98
|
+
If you're on Ubuntu, you'll want to run the following with apt-get:
|
99
|
+
|
100
|
+
sudo apt-get install imagemagick -y
|
101
|
+
|
102
|
+
If you're on Ubuntu (or any Debian base Linux distribution), you'll want to run the following with apt-get:
|
103
|
+
|
104
|
+
sudo apt-get install imagemagick -y
|
105
|
+
|
98
106
|
### `file`
|
99
107
|
|
100
108
|
The Unix [`file` command](http://en.wikipedia.org/wiki/File_(command)) is required for content-type checking.
|
@@ -143,13 +151,7 @@ Paperclip is distributed as a gem, which is how it should be used in your app.
|
|
143
151
|
Include the gem in your Gemfile:
|
144
152
|
|
145
153
|
```ruby
|
146
|
-
gem "paperclip", "~> 4.
|
147
|
-
```
|
148
|
-
|
149
|
-
If you're still using Rails 2.3.x, you should do this instead:
|
150
|
-
|
151
|
-
```ruby
|
152
|
-
gem "paperclip", "~> 2.7"
|
154
|
+
gem "paperclip", "~> 4.3"
|
153
155
|
```
|
154
156
|
|
155
157
|
Or, if you want to get the latest, you can get master from the main paperclip repository:
|
@@ -10,7 +10,7 @@ end
|
|
10
10
|
World(AttachmentHelpers)
|
11
11
|
|
12
12
|
When /^I modify my attachment definition to:$/ do |definition|
|
13
|
-
content =
|
13
|
+
content = cd(".") { File.read("app/models/user.rb") }
|
14
14
|
name = content[/has_attached_file :\w+/][/:\w+/]
|
15
15
|
content.gsub!(/has_attached_file.+end/m, <<-FILE)
|
16
16
|
#{definition}
|
@@ -19,7 +19,7 @@ When /^I modify my attachment definition to:$/ do |definition|
|
|
19
19
|
FILE
|
20
20
|
|
21
21
|
write_file "app/models/user.rb", content
|
22
|
-
|
22
|
+
cd(".") { FileUtils.rm_rf ".rbx" }
|
23
23
|
end
|
24
24
|
|
25
25
|
When /^I upload the fixture "([^"]*)"$/ do |filename|
|
@@ -27,20 +27,20 @@ When /^I upload the fixture "([^"]*)"$/ do |filename|
|
|
27
27
|
end
|
28
28
|
|
29
29
|
Then /^the attachment "([^"]*)" should have a dimension of (\d+x\d+)$/ do |filename, dimension|
|
30
|
-
|
30
|
+
cd(".") do
|
31
31
|
geometry = `identify -format "%wx%h" "#{attachment_path(filename)}"`.strip
|
32
|
-
geometry.
|
32
|
+
expect(geometry).to eq(dimension)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
Then /^the attachment "([^"]*)" should exist$/ do |filename|
|
37
|
-
|
38
|
-
File.exist?(attachment_path(filename)).
|
37
|
+
cd(".") do
|
38
|
+
expect(File.exist?(attachment_path(filename))).to be true
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
When /^I swap the attachment "([^"]*)" with the fixture "([^"]*)"$/ do |attachment_filename, fixture_filename|
|
43
|
-
|
43
|
+
cd(".") do
|
44
44
|
require 'fileutils'
|
45
45
|
FileUtils.rm_f attachment_path(attachment_filename)
|
46
46
|
FileUtils.cp fixture_path(fixture_filename), attachment_path(attachment_filename)
|
@@ -48,7 +48,7 @@ When /^I swap the attachment "([^"]*)" with the fixture "([^"]*)"$/ do |attachme
|
|
48
48
|
end
|
49
49
|
|
50
50
|
Then /^the attachment should have the same content type as the fixture "([^"]*)"$/ do |filename|
|
51
|
-
|
51
|
+
cd(".") do
|
52
52
|
begin
|
53
53
|
# Use mime/types/columnar if available, for reduced memory usage
|
54
54
|
require "mime/types/columnar"
|
@@ -57,32 +57,33 @@ Then /^the attachment should have the same content type as the fixture "([^"]*)"
|
|
57
57
|
end
|
58
58
|
|
59
59
|
attachment_content_type = `bundle exec #{runner_command} "puts User.last.attachment_content_type"`.strip
|
60
|
-
|
60
|
+
expected = MIME::Types.type_for(filename).first.content_type
|
61
|
+
expect(attachment_content_type).to eq(expected)
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
64
65
|
Then /^the attachment should have the same file name as the fixture "([^"]*)"$/ do |filename|
|
65
|
-
|
66
|
+
cd(".") do
|
66
67
|
attachment_file_name = `bundle exec #{runner_command} "puts User.last.attachment_file_name"`.strip
|
67
|
-
attachment_file_name.
|
68
|
+
expect(attachment_file_name).to eq(File.name(fixture_path(filename)).to_s)
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
71
72
|
Then /^the attachment should have the same file size as the fixture "([^"]*)"$/ do |filename|
|
72
|
-
|
73
|
+
cd(".") do
|
73
74
|
attachment_file_size = `bundle exec #{runner_command} "puts User.last.attachment_file_size"`.strip
|
74
|
-
attachment_file_size.
|
75
|
+
expect(attachment_file_size).to eq(File.size(fixture_path(filename)).to_s)
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
78
79
|
Then /^the attachment file "([^"]*)" should (not )?exist$/ do |filename, not_exist|
|
79
|
-
|
80
|
-
|
80
|
+
cd(".") do
|
81
|
+
expect(attachment_path(filename)).not_to be_an_existing_file
|
81
82
|
end
|
82
83
|
end
|
83
84
|
|
84
85
|
Then /^I should have attachment columns for "([^"]*)"$/ do |attachment_name|
|
85
|
-
|
86
|
+
cd(".") do
|
86
87
|
columns = eval(`bundle exec #{runner_command} "puts User.columns.map{ |column| [column.name, column.type] }.inspect"`.strip)
|
87
88
|
expect_columns = [
|
88
89
|
["#{attachment_name}_file_name", :string],
|
@@ -90,13 +91,12 @@ Then /^I should have attachment columns for "([^"]*)"$/ do |attachment_name|
|
|
90
91
|
["#{attachment_name}_file_size", :integer],
|
91
92
|
["#{attachment_name}_updated_at", :datetime]
|
92
93
|
]
|
93
|
-
|
94
|
-
expect_columns.all?{ |column| columns.include? column }.should eq true
|
94
|
+
expect(columns).to include(*expect_columns)
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
98
|
Then /^I should not have attachment columns for "([^"]*)"$/ do |attachment_name|
|
99
|
-
|
99
|
+
cd(".") do
|
100
100
|
columns = eval(`bundle exec #{runner_command} "puts User.columns.map{ |column| [column.name, column.type] }.inspect"`.strip)
|
101
101
|
expect_columns = [
|
102
102
|
["#{attachment_name}_file_name", :string],
|
@@ -105,6 +105,6 @@ Then /^I should not have attachment columns for "([^"]*)"$/ do |attachment_name|
|
|
105
105
|
["#{attachment_name}_updated_at", :datetime]
|
106
106
|
]
|
107
107
|
|
108
|
-
|
108
|
+
expect(columns).not_to include(*expect_columns)
|
109
109
|
end
|
110
110
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Then %r{I should see an image with a path of "([^"]*)"} do |path|
|
2
|
-
page.
|
2
|
+
expect(page).to have_css("img[src^='#{path}']")
|
3
3
|
end
|
4
4
|
|
5
5
|
Then %r{^the file at "([^"]*)" is the same as "([^"]*)"$} do |web_file, path|
|
@@ -11,5 +11,5 @@ Then %r{^the file at "([^"]*)" is the same as "([^"]*)"$} do |web_file, path|
|
|
11
11
|
page.body
|
12
12
|
end
|
13
13
|
actual.force_encoding("UTF-8") if actual.respond_to?(:force_encoding)
|
14
|
-
actual.
|
14
|
+
expect(actual).to eq(expected)
|
15
15
|
end
|
@@ -24,7 +24,7 @@ Given /^I generate a new rails application$/ do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
Given "I fix the application.rb for 3.0.12" do
|
27
|
-
|
27
|
+
cd(".") do
|
28
28
|
File.open("config/application.rb", "a") do |f|
|
29
29
|
f << "ActionController::Base.config.relative_url_root = ''"
|
30
30
|
end
|
@@ -32,7 +32,7 @@ Given "I fix the application.rb for 3.0.12" do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
Given "I allow the attachment to be submitted" do
|
35
|
-
|
35
|
+
cd(".") do
|
36
36
|
transform_file("app/controllers/users_controller.rb") do |content|
|
37
37
|
content.gsub("params.require(:user).permit(:name)",
|
38
38
|
"params.require(:user).permit!")
|
@@ -41,7 +41,7 @@ Given "I allow the attachment to be submitted" do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
Given "I remove turbolinks" do
|
44
|
-
|
44
|
+
cd(".") do
|
45
45
|
transform_file("app/assets/javascripts/application.js") do |content|
|
46
46
|
content.gsub("//= require turbolinks", "")
|
47
47
|
end
|
@@ -70,7 +70,7 @@ def attach_attachment(name, definition = nil)
|
|
70
70
|
snippet += definition
|
71
71
|
end
|
72
72
|
snippet += "\ndo_not_validate_attachment_file_type :#{name}\n"
|
73
|
-
|
73
|
+
cd(".") do
|
74
74
|
transform_file("app/models/user.rb") do |content|
|
75
75
|
content.sub(/end\Z/, "#{snippet}\nend")
|
76
76
|
end
|
@@ -78,7 +78,7 @@ def attach_attachment(name, definition = nil)
|
|
78
78
|
end
|
79
79
|
|
80
80
|
Given "I empty the application.js file" do
|
81
|
-
|
81
|
+
cd(".") do
|
82
82
|
transform_file("app/assets/javascripts/application.js") do |content|
|
83
83
|
""
|
84
84
|
end
|
@@ -128,7 +128,7 @@ end
|
|
128
128
|
|
129
129
|
Given /^I add this snippet to the User model:$/ do |snippet|
|
130
130
|
file_name = "app/models/user.rb"
|
131
|
-
|
131
|
+
cd(".") do
|
132
132
|
content = File.read(file_name)
|
133
133
|
File.open(file_name, 'w') { |f| f << content.sub(/end\Z/, "#{snippet}\nend") }
|
134
134
|
end
|
@@ -136,14 +136,14 @@ end
|
|
136
136
|
|
137
137
|
Given /^I add this snippet to config\/application.rb:$/ do |snippet|
|
138
138
|
file_name = "config/application.rb"
|
139
|
-
|
139
|
+
cd(".") do
|
140
140
|
content = File.read(file_name)
|
141
141
|
File.open(file_name, 'w') {|f| f << content.sub(/class Application < Rails::Application.*$/, "class Application < Rails::Application\n#{snippet}\n")}
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
145
|
Given /^I start the rails application$/ do
|
146
|
-
|
146
|
+
cd(".") do
|
147
147
|
require "./config/environment"
|
148
148
|
require "capybara/rails"
|
149
149
|
end
|
@@ -154,7 +154,7 @@ Given /^I reload my application$/ do
|
|
154
154
|
end
|
155
155
|
|
156
156
|
When /^I turn off class caching$/ do
|
157
|
-
|
157
|
+
cd(".") do
|
158
158
|
file = "config/environments/test.rb"
|
159
159
|
config = IO.read(file)
|
160
160
|
config.gsub!(%r{^\s*config.cache_classes.*$},
|
@@ -166,7 +166,7 @@ end
|
|
166
166
|
Then /^the file at "([^"]*)" should be the same as "([^"]*)"$/ do |web_file, path|
|
167
167
|
expected = IO.read(path)
|
168
168
|
actual = read_from_web(web_file)
|
169
|
-
actual.
|
169
|
+
expect(actual).to eq(expected)
|
170
170
|
end
|
171
171
|
|
172
172
|
When /^I configure the application to use "([^\"]+)" from this project$/ do |name|
|
@@ -198,7 +198,7 @@ end
|
|
198
198
|
|
199
199
|
Given(/^I add a "(.*?)" processor in "(.*?)"$/) do |processor, directory|
|
200
200
|
filename = "#{directory}/#{processor}.rb"
|
201
|
-
|
201
|
+
cd(".") do
|
202
202
|
FileUtils.mkdir_p directory
|
203
203
|
File.open(filename, "w") do |f|
|
204
204
|
f.write(<<-CLASS)
|
@@ -103,107 +103,5 @@ When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
|
|
103
103
|
end
|
104
104
|
|
105
105
|
Then /^(?:|I )should see "([^"]*)"$/ do |text|
|
106
|
-
|
107
|
-
page.should have_content(text)
|
108
|
-
else
|
109
|
-
assert page.has_content?(text)
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
|
114
|
-
regexp = Regexp.new(regexp)
|
115
|
-
|
116
|
-
if page.respond_to? :should
|
117
|
-
page.should have_xpath('//*', :text => regexp)
|
118
|
-
else
|
119
|
-
assert page.has_xpath?('//*', :text => regexp)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
Then /^(?:|I )should not see "([^"]*)"$/ do |text|
|
124
|
-
if page.respond_to? :should
|
125
|
-
page.should have_no_content(text)
|
126
|
-
else
|
127
|
-
assert page.has_no_content?(text)
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
|
132
|
-
regexp = Regexp.new(regexp)
|
133
|
-
|
134
|
-
if page.respond_to? :should
|
135
|
-
page.should have_no_xpath('//*', :text => regexp)
|
136
|
-
else
|
137
|
-
assert page.has_no_xpath?('//*', :text => regexp)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
|
142
|
-
with_scope(parent) do
|
143
|
-
field = find_field(field)
|
144
|
-
if field.value.respond_to? :should
|
145
|
-
field.value.should =~ /#{value}/
|
146
|
-
else
|
147
|
-
assert_match(/#{value}/, field.value)
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
|
153
|
-
with_scope(parent) do
|
154
|
-
field = find_field(field)
|
155
|
-
if field.value.respond_to? :should_not
|
156
|
-
field.value.should_not =~ /#{value}/
|
157
|
-
else
|
158
|
-
assert_no_match(/#{value}/, field.value)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent|
|
164
|
-
with_scope(parent) do
|
165
|
-
field_checked = find_field(label)['checked']
|
166
|
-
if field_checked.respond_to? :should
|
167
|
-
field_checked.should eq true
|
168
|
-
else
|
169
|
-
assert field_checked
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent|
|
175
|
-
with_scope(parent) do
|
176
|
-
field_checked = find_field(label)['checked']
|
177
|
-
if field_checked.respond_to? :should
|
178
|
-
field_checked.should eq false
|
179
|
-
else
|
180
|
-
assert !field_checked
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
186
|
-
current_path = URI.parse(current_url).path
|
187
|
-
if current_path.respond_to? :should
|
188
|
-
current_path.should == path_to(page_name)
|
189
|
-
else
|
190
|
-
assert_equal path_to(page_name), current_path
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
195
|
-
query = URI.parse(current_url).query
|
196
|
-
actual_params = query ? CGI.parse(query) : {}
|
197
|
-
expected_params = {}
|
198
|
-
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
199
|
-
|
200
|
-
if actual_params.respond_to? :should
|
201
|
-
actual_params.should == expected_params
|
202
|
-
else
|
203
|
-
assert_equal expected_params, actual_params
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
Then /^show me the page$/ do
|
208
|
-
save_and_open_page
|
106
|
+
expect(page).to have_content(text)
|
209
107
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module FileHelpers
|
2
2
|
def append_to(path, contents)
|
3
|
-
|
3
|
+
cd(".") do
|
4
4
|
File.open(path, "a") do |file|
|
5
5
|
file.puts
|
6
6
|
file.puts contents
|
@@ -13,7 +13,7 @@ module FileHelpers
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def comment_out_gem_in_gemfile(gemname)
|
16
|
-
|
16
|
+
cd(".") do
|
17
17
|
gemfile = File.read("Gemfile")
|
18
18
|
gemfile.sub!(/^(\s*)(gem\s*['"]#{gemname})/, "\\1# \\2")
|
19
19
|
File.open("Gemfile", 'w'){ |file| file.write(gemfile) }
|
data/gemfiles/3.2.gemfile
CHANGED
@@ -8,8 +8,7 @@ gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
|
|
8
8
|
gem "rubysl", :platforms => :rbx
|
9
9
|
gem "racc", :platforms => :rbx
|
10
10
|
gem "pry"
|
11
|
-
gem "rails", "~> 3.2.
|
12
|
-
gem "paperclip", :path => "../"
|
11
|
+
gem "rails", "~> 3.2.0"
|
13
12
|
|
14
13
|
group :development, :test do
|
15
14
|
gem "mime-types", "~> 1.16"
|
data/gemfiles/4.1.gemfile
CHANGED
data/gemfiles/4.2.gemfile
CHANGED
data/lib/paperclip/attachment.rb
CHANGED
@@ -137,8 +137,6 @@ module Paperclip
|
|
137
137
|
# +#for(style_name, options_hash)+
|
138
138
|
|
139
139
|
def url(style_name = default_style, options = {})
|
140
|
-
return nil if @instance.new_record?
|
141
|
-
|
142
140
|
if options == true || options == false # Backwards compatibility.
|
143
141
|
@url_generator.for(style_name, default_options.merge(:timestamp => options))
|
144
142
|
else
|
data/lib/paperclip/glue.rb
CHANGED
@@ -8,7 +8,7 @@ module Paperclip
|
|
8
8
|
base.extend ClassMethods
|
9
9
|
base.send :include, Callbacks
|
10
10
|
base.send :include, Validators
|
11
|
-
base.send :include, Schema
|
11
|
+
base.send :include, Schema if defined? ActiveRecord
|
12
12
|
|
13
13
|
locale_path = Dir.glob(File.dirname(__FILE__) + "/locales/*.{rb,yml}")
|
14
14
|
I18n.load_path += locale_path unless I18n.load_path.include?(locale_path)
|
data/lib/paperclip/schema.rb
CHANGED
@@ -40,7 +40,7 @@ module Paperclip
|
|
40
40
|
attachment_names.each do |attachment_name|
|
41
41
|
COLUMNS.each_pair do |column_name, column_type|
|
42
42
|
column_options = options.merge(options[column_name.to_sym] || {})
|
43
|
-
remove_column(table_name, "#{attachment_name}_#{column_name}"
|
43
|
+
remove_column(table_name, "#{attachment_name}_#{column_name}")
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
data/lib/paperclip/version.rb
CHANGED
data/paperclip.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
|
29
29
|
s.add_development_dependency('activerecord', '>= 3.2.0')
|
30
30
|
s.add_development_dependency('shoulda')
|
31
|
-
s.add_development_dependency('rspec')
|
31
|
+
s.add_development_dependency('rspec', '~> 3.0')
|
32
32
|
s.add_development_dependency('appraisal')
|
33
33
|
s.add_development_dependency('mocha')
|
34
34
|
s.add_development_dependency('aws-sdk', '>= 1.5.7', "<= 2.0")
|
@@ -254,6 +254,7 @@ describe Paperclip::Attachment do
|
|
254
254
|
|
255
255
|
context "without an Attachment" do
|
256
256
|
before do
|
257
|
+
rebuild_model default_url: "default.url"
|
257
258
|
@dummy = Dummy.new
|
258
259
|
end
|
259
260
|
|
@@ -261,8 +262,8 @@ describe Paperclip::Attachment do
|
|
261
262
|
assert !@dummy.avatar.exists?
|
262
263
|
end
|
263
264
|
|
264
|
-
it "#url returns
|
265
|
-
|
265
|
+
it "#url returns the default_url" do
|
266
|
+
expect(@dummy.avatar.url).to eq "default.url"
|
266
267
|
end
|
267
268
|
end
|
268
269
|
|
@@ -1490,6 +1491,4 @@ describe Paperclip::Attachment do
|
|
1490
1491
|
assert_file_exists(@path)
|
1491
1492
|
end
|
1492
1493
|
end
|
1493
|
-
|
1494
1494
|
end
|
1495
|
-
|
@@ -82,7 +82,7 @@ describe Paperclip::Geometry do
|
|
82
82
|
assert_equal 456, @upper.height
|
83
83
|
end
|
84
84
|
|
85
|
-
['>', '<', '#', '@', '%', '^', '!', nil].each do |mod|
|
85
|
+
['>', '<', '#', '@', '@>', '>@', '%', '^', '!', nil].each do |mod|
|
86
86
|
it "ensures the modifier #{description} is preserved" do
|
87
87
|
assert @geo = Paperclip::Geometry.parse("123x456#{mod}")
|
88
88
|
assert_equal mod, @geo.modifier
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# require "spec_helper"
|
2
|
+
|
3
|
+
describe Paperclip::Glue do
|
4
|
+
describe "when ActiveRecord does not exist" do
|
5
|
+
before do
|
6
|
+
ActiveRecordSaved = ActiveRecord
|
7
|
+
Object.send :remove_const, "ActiveRecord"
|
8
|
+
end
|
9
|
+
|
10
|
+
after do
|
11
|
+
ActiveRecord = ActiveRecordSaved
|
12
|
+
Object.send :remove_const, "ActiveRecordSaved"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "does not fail" do
|
16
|
+
NonActiveRecordModel = Class.new
|
17
|
+
NonActiveRecordModel.send :include, Paperclip::Glue
|
18
|
+
Object.send :remove_const, "NonActiveRecordModel"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "when ActiveRecord does exist" do
|
23
|
+
before do
|
24
|
+
if Object.const_defined?("ActiveRecord")
|
25
|
+
@defined_active_record = false
|
26
|
+
else
|
27
|
+
ActiveRecord = :defined
|
28
|
+
@defined_active_record = true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
after do
|
33
|
+
if @defined_active_record
|
34
|
+
Object.send :remove_const, "ActiveRecord"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
it "does not fail" do
|
39
|
+
NonActiveRecordModel = Class.new
|
40
|
+
NonActiveRecordModel.send :include, Paperclip::Glue
|
41
|
+
Object.send :remove_const, "NonActiveRecordModel"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -20,6 +20,9 @@ FIXTURES_DIR = File.join(File.dirname(__FILE__), "fixtures")
|
|
20
20
|
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
|
21
21
|
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
22
22
|
ActiveRecord::Base.establish_connection(config['test'])
|
23
|
+
unless ActiveRecord::VERSION::STRING < "4.2"
|
24
|
+
ActiveRecord::Base.raise_in_transactional_callbacks = true
|
25
|
+
end
|
23
26
|
Paperclip.options[:logger] = ActiveRecord::Base.logger
|
24
27
|
|
25
28
|
Dir[File.join(ROOT, 'spec', 'support', '**', '*.rb')].each{|f| require f }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Yurek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
117
|
+
version: '3.0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
124
|
+
version: '3.0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: appraisal
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -490,6 +490,7 @@ files:
|
|
490
490
|
- spec/paperclip/geometry_detector_spec.rb
|
491
491
|
- spec/paperclip/geometry_parser_spec.rb
|
492
492
|
- spec/paperclip/geometry_spec.rb
|
493
|
+
- spec/paperclip/glue_spec.rb
|
493
494
|
- spec/paperclip/has_attached_file_spec.rb
|
494
495
|
- spec/paperclip/integration_spec.rb
|
495
496
|
- spec/paperclip/interpolations_spec.rb
|
@@ -585,7 +586,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
585
586
|
requirements:
|
586
587
|
- ImageMagick
|
587
588
|
rubyforge_project:
|
588
|
-
rubygems_version: 2.4.5
|
589
|
+
rubygems_version: 2.4.5.1
|
589
590
|
signing_key:
|
590
591
|
specification_version: 4
|
591
592
|
summary: File attachments as attributes for ActiveRecord
|
@@ -618,6 +619,7 @@ test_files:
|
|
618
619
|
- spec/paperclip/geometry_detector_spec.rb
|
619
620
|
- spec/paperclip/geometry_parser_spec.rb
|
620
621
|
- spec/paperclip/geometry_spec.rb
|
622
|
+
- spec/paperclip/glue_spec.rb
|
621
623
|
- spec/paperclip/has_attached_file_spec.rb
|
622
624
|
- spec/paperclip/integration_spec.rb
|
623
625
|
- spec/paperclip/interpolations_spec.rb
|
@@ -692,4 +694,3 @@ test_files:
|
|
692
694
|
- spec/support/rails_helpers.rb
|
693
695
|
- spec/support/test_data.rb
|
694
696
|
- spec/support/version_helper.rb
|
695
|
-
has_rdoc:
|