Commit 3601cc6b by Jon Yurek

Revert "remove whitespace, not main gemspec"

This reverts commit 8d70c198.
parent 68d777fb
...@@ -17,5 +17,4 @@ gem 'pry' ...@@ -17,5 +17,4 @@ gem 'pry'
group :development, :test do group :development, :test do
gem 'mime-types', '~> 1.16' gem 'mime-types', '~> 1.16'
gem 'builder', '~> 3.1.4' gem 'builder', '~> 3.1.4'
gem 'activerecord-import'
end end
...@@ -48,4 +48,5 @@ Gem::Specification.new do |s| ...@@ -48,4 +48,5 @@ Gem::Specification.new do |s|
s.add_development_dependency('actionmailer', '>= 3.0.0') s.add_development_dependency('actionmailer', '>= 3.0.0')
s.add_development_dependency('generator_spec') s.add_development_dependency('generator_spec')
s.add_development_dependency('timecop') s.add_development_dependency('timecop')
s.add_development_dependency('activerecord-import')
end end
...@@ -14,9 +14,9 @@ describe 'Paperclip' do ...@@ -14,9 +14,9 @@ describe 'Paperclip' do
after { @file.close } after { @file.close }
it "does not exceed the open file limit" do it "does not exceed the open file limit" do
assert_nothing_raised do assert_nothing_raised do
Dummy.all.each { |dummy| dummy.avatar } Dummy.all.each { |dummy| dummy.avatar }
end end
end end
end end
...@@ -163,8 +163,8 @@ describe 'Paperclip' do ...@@ -163,8 +163,8 @@ describe 'Paperclip' do
context "A model with attachments scoped under an id" do context "A model with attachments scoped under an id" do
before do before do
rebuild_model styles: { large: "100x100", rebuild_model styles: { large: "100x100",
medium: "50x50" }, medium: "50x50" },
path: ":rails_root/tmp/:id/:attachments/:style.:extension" path: ":rails_root/tmp/:id/:attachments/:style.:extension"
@dummy = Dummy.new @dummy = Dummy.new
@file = File.new(fixture_file("5k.png"), 'rb') @file = File.new(fixture_file("5k.png"), 'rb')
@dummy.avatar = @file @dummy.avatar = @file
...@@ -264,11 +264,11 @@ describe 'Paperclip' do ...@@ -264,11 +264,11 @@ describe 'Paperclip' do
context "A model with a filesystem attachment" do context "A model with a filesystem attachment" do
before do before do
rebuild_model styles: { large: "300x300>", rebuild_model styles: { large: "300x300>",
medium: "100x100", medium: "100x100",
thumb: ["32x32#", :gif] }, thumb: ["32x32#", :gif] },
default_style: :medium, default_style: :medium,
url: "/:attachment/:class/:style/:id/:basename.:extension", url: "/:attachment/:class/:style/:id/:basename.:extension",
path: ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension" path: ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension"
@dummy = Dummy.new @dummy = Dummy.new
@file = File.new(fixture_file("5k.png"), 'rb') @file = File.new(fixture_file("5k.png"), 'rb')
@bad_file = File.new(fixture_file("bad.png"), 'rb') @bad_file = File.new(fixture_file("bad.png"), 'rb')
...@@ -285,37 +285,37 @@ describe 'Paperclip' do ...@@ -285,37 +285,37 @@ describe 'Paperclip' do
["300x46", :large], ["300x46", :large],
["100x15", :medium], ["100x15", :medium],
["32x32", :thumb]].each do |geo, style| ["32x32", :thumb]].each do |geo, style|
cmd = %Q[identify -format "%wx%h" "#{@dummy.avatar.path(style)}"] cmd = %Q[identify -format "%wx%h" "#{@dummy.avatar.path(style)}"]
assert_equal geo, `#{cmd}`.chomp, cmd assert_equal geo, `#{cmd}`.chomp, cmd
end end
saved_paths = [:thumb, :medium, :large, :original].collect{|s| @dummy.avatar.path(s) } saved_paths = [:thumb, :medium, :large, :original].collect{|s| @dummy.avatar.path(s) }
@d2 = Dummy.find(@dummy.id) @d2 = Dummy.find(@dummy.id)
assert_equal "100x15", `identify -format "%wx%h" "#{@d2.avatar.path}"`.chomp assert_equal "100x15", `identify -format "%wx%h" "#{@d2.avatar.path}"`.chomp
assert_equal "434x66", `identify -format "%wx%h" "#{@d2.avatar.path(:original)}"`.chomp assert_equal "434x66", `identify -format "%wx%h" "#{@d2.avatar.path(:original)}"`.chomp
assert_equal "300x46", `identify -format "%wx%h" "#{@d2.avatar.path(:large)}"`.chomp assert_equal "300x46", `identify -format "%wx%h" "#{@d2.avatar.path(:large)}"`.chomp
assert_equal "100x15", `identify -format "%wx%h" "#{@d2.avatar.path(:medium)}"`.chomp assert_equal "100x15", `identify -format "%wx%h" "#{@d2.avatar.path(:medium)}"`.chomp
assert_equal "32x32", `identify -format "%wx%h" "#{@d2.avatar.path(:thumb)}"`.chomp assert_equal "32x32", `identify -format "%wx%h" "#{@d2.avatar.path(:thumb)}"`.chomp
assert @dummy.valid? assert @dummy.valid?
assert @dummy.save assert @dummy.save
saved_paths.each do |p| saved_paths.each do |p|
assert_file_exists(p) assert_file_exists(p)
end end
@dummy.avatar.clear @dummy.avatar.clear
assert_nil @dummy.avatar_file_name assert_nil @dummy.avatar_file_name
assert @dummy.valid? assert @dummy.valid?
assert @dummy.save assert @dummy.save
saved_paths.each do |p| saved_paths.each do |p|
assert_file_not_exists(p) assert_file_not_exists(p)
end end
@d2 = Dummy.find(@dummy.id) @d2 = Dummy.find(@dummy.id)
assert_nil @d2.avatar_file_name assert_nil @d2.avatar_file_name
end end
it "works exactly the same when new as when reloaded" do it "works exactly the same when new as when reloaded" do
...@@ -410,9 +410,9 @@ describe 'Paperclip' do ...@@ -410,9 +410,9 @@ describe 'Paperclip' do
context "A model with an attachment with hash in file name" do context "A model with an attachment with hash in file name" do
before do before do
@settings = { styles: { thumb: "50x50#" }, @settings = { styles: { thumb: "50x50#" },
path: ":rails_root/public/system/:attachment/:id_partition/:style/:hash.:extension", path: ":rails_root/public/system/:attachment/:id_partition/:style/:hash.:extension",
url: "/system/:attachment/:id_partition/:style/:hash.:extension", url: "/system/:attachment/:id_partition/:style/:hash.:extension",
hash_secret: "somesecret" } hash_secret: "somesecret" }
rebuild_model @settings rebuild_model @settings
...@@ -526,31 +526,31 @@ describe 'Paperclip' do ...@@ -526,31 +526,31 @@ describe 'Paperclip' do
["300x46", :large], ["300x46", :large],
["100x15", :medium], ["100x15", :medium],
["32x32", :thumb]].each do |geo, style| ["32x32", :thumb]].each do |geo, style|
cmd = %Q[identify -format "%wx%h" "#{@files_on_s3[style].path}"] cmd = %Q[identify -format "%wx%h" "#{@files_on_s3[style].path}"]
assert_equal geo, `#{cmd}`.chomp, cmd assert_equal geo, `#{cmd}`.chomp, cmd
end end
@d2 = Dummy.find(@dummy.id) @d2 = Dummy.find(@dummy.id)
@d2_files = s3_files_for @d2.avatar @d2_files = s3_files_for @d2.avatar
[["434x66", :original], [["434x66", :original],
["300x46", :large], ["300x46", :large],
["100x15", :medium], ["100x15", :medium],
["32x32", :thumb]].each do |geo, style| ["32x32", :thumb]].each do |geo, style|
cmd = %Q[identify -format "%wx%h" "#{@d2_files[style].path}"] cmd = %Q[identify -format "%wx%h" "#{@d2_files[style].path}"]
assert_equal geo, `#{cmd}`.chomp, cmd assert_equal geo, `#{cmd}`.chomp, cmd
end end
@dummy.avatar.clear @dummy.avatar.clear
assert_nil @dummy.avatar_file_name assert_nil @dummy.avatar_file_name
assert @dummy.valid? assert @dummy.valid?
assert @dummy.save assert @dummy.save
[:thumb, :medium, :large, :original].each do |style| [:thumb, :medium, :large, :original].each do |style|
assert ! @dummy.avatar.exists?(style) assert ! @dummy.avatar.exists?(style)
end end
@d2 = Dummy.find(@dummy.id) @d2 = Dummy.find(@dummy.id)
assert_nil @d2.avatar_file_name assert_nil @d2.avatar_file_name
end end
it "works exactly the same when new as when reloaded" do it "works exactly the same when new as when reloaded" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment