Commit 04094b6f by Prem Sichanugrist

Cleanup whitespaces

parent 5a138fd9
...@@ -181,7 +181,7 @@ Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label ...@@ -181,7 +181,7 @@ Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label
end end
end end
end end
Then /^(?:|I )should be on (.+)$/ do |page_name| Then /^(?:|I )should be on (.+)$/ do |page_name|
current_path = URI.parse(current_url).path current_path = URI.parse(current_url).path
if current_path.respond_to? :should if current_path.respond_to? :should
...@@ -195,8 +195,8 @@ Then /^(?:|I )should have the following query string:$/ do |expected_pairs| ...@@ -195,8 +195,8 @@ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
query = URI.parse(current_url).query query = URI.parse(current_url).query
actual_params = query ? CGI.parse(query) : {} actual_params = query ? CGI.parse(query) : {}
expected_params = {} expected_params = {}
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
if actual_params.respond_to? :should if actual_params.respond_to? :should
actual_params.should == expected_params actual_params.should == expected_params
else else
......
...@@ -41,7 +41,7 @@ module Paperclip ...@@ -41,7 +41,7 @@ module Paperclip
# #
# class ActiveSupport::TestCase # class ActiveSupport::TestCase
# extend Paperclip::Shoulda::Matchers # extend Paperclip::Shoulda::Matchers
# #
# #...other initializers...# # #...other initializers...#
# end # end
# #
...@@ -57,7 +57,7 @@ module Paperclip ...@@ -57,7 +57,7 @@ module Paperclip
# should validate_attachment_size(:avatar). # should validate_attachment_size(:avatar).
# less_than(2.megabytes) # less_than(2.megabytes)
# end # end
# #
module Matchers module Matchers
end end
end end
......
...@@ -51,7 +51,7 @@ module Paperclip ...@@ -51,7 +51,7 @@ module Paperclip
end end
protected protected
def accepted_types_and_failures def accepted_types_and_failures
if @allowed_types.present? if @allowed_types.present?
"Accept content types: #{@allowed_types.join(", ")}\n".tap do |message| "Accept content types: #{@allowed_types.join(", ")}\n".tap do |message|
...@@ -61,7 +61,7 @@ module Paperclip ...@@ -61,7 +61,7 @@ module Paperclip
message << " All were accepted successfully." message << " All were accepted successfully."
end end
end end
end end
end end
def rejected_types_and_failures def rejected_types_and_failures
if @rejected_types.present? if @rejected_types.present?
...@@ -74,10 +74,10 @@ module Paperclip ...@@ -74,10 +74,10 @@ module Paperclip
end end
end end
end end
def expected_attachment def expected_attachment
"Expected #{@attachment_name}:\n" "Expected #{@attachment_name}:\n"
end end
def type_allowed?(type) def type_allowed?(type)
@subject.send("#{@attachment_name}_content_type=", type) @subject.send("#{@attachment_name}_content_type=", type)
......
...@@ -197,7 +197,7 @@ module Paperclip ...@@ -197,7 +197,7 @@ module Paperclip
else else
@options[:fog_directory] @options[:fog_directory]
end end
@directory ||= connection.directories.new(:key => dir) @directory ||= connection.directories.new(:key => dir)
end end
end end
......
...@@ -61,7 +61,7 @@ module Paperclip ...@@ -61,7 +61,7 @@ module Paperclip
# Normally, this won't matter in the slightest and you can leave the default (which is # Normally, this won't matter in the slightest and you can leave the default (which is
# path-style, or :s3_path_url). But in some cases paths don't work and you need to use # path-style, or :s3_path_url). But in some cases paths don't work and you need to use
# the domain-style (:s3_domain_url). Anything else here will be treated like path-style. # the domain-style (:s3_domain_url). Anything else here will be treated like path-style.
# #
# Notes: # Notes:
# * The value of this option is a string, not a symbol. # * The value of this option is a string, not a symbol.
# <b>right:</b> <tt>":s3_domain_url"</tt> # <b>right:</b> <tt>":s3_domain_url"</tt>
......
...@@ -52,12 +52,12 @@ module Paperclip ...@@ -52,12 +52,12 @@ module Paperclip
end end
def convert_options def convert_options
@convert_options.respond_to?(:call) ? @convert_options.call(attachment.instance) : @convert_options.respond_to?(:call) ? @convert_options.call(attachment.instance) :
(@convert_options || attachment.send(:extra_options_for, name)) (@convert_options || attachment.send(:extra_options_for, name))
end end
def source_file_options def source_file_options
@source_file_options.respond_to?(:call) ? @source_file_options.call(attachment.instance) : @source_file_options.respond_to?(:call) ? @source_file_options.call(attachment.instance) :
(@source_file_options || attachment.send(:extra_source_file_options_for, name)) (@source_file_options || attachment.send(:extra_source_file_options_for, name))
end end
......
...@@ -744,7 +744,7 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -744,7 +744,7 @@ class AttachmentTest < Test::Unit::TestCase
rebuild_model rebuild_model
@file = Tempfile.new(["filename","png"]) @file = Tempfile.new(["filename","png"])
end end
teardown do teardown do
@file.unlink @file.unlink
end end
...@@ -752,7 +752,7 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -752,7 +752,7 @@ class AttachmentTest < Test::Unit::TestCase
context "with default configuration" do context "with default configuration" do
"&$+,/:;=?@<>[]{}|\^~%# ".split(//).each do |character| "&$+,/:;=?@<>[]{}|\^~%# ".split(//).each do |character|
context "with character #{character}" do context "with character #{character}" do
context "at beginning of filename" do context "at beginning of filename" do
setup do setup do
@file.stubs(:original_filename).returns("#{character}filename.png") @file.stubs(:original_filename).returns("#{character}filename.png")
...@@ -762,9 +762,9 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -762,9 +762,9 @@ class AttachmentTest < Test::Unit::TestCase
should "convert special character into underscore" do should "convert special character into underscore" do
assert_equal "_filename.png", @dummy.avatar.original_filename assert_equal "_filename.png", @dummy.avatar.original_filename
end end
end end
context "at end of filename" do context "at end of filename" do
setup do setup do
@file.stubs(:original_filename).returns("filename.png#{character}") @file.stubs(:original_filename).returns("filename.png#{character}")
...@@ -776,7 +776,7 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -776,7 +776,7 @@ class AttachmentTest < Test::Unit::TestCase
assert_equal "filename.png_", @dummy.avatar.original_filename assert_equal "filename.png_", @dummy.avatar.original_filename
end end
end end
context "in the middle of filename" do context "in the middle of filename" do
setup do setup do
@file.stubs(:original_filename).returns("file#{character}name.png") @file.stubs(:original_filename).returns("file#{character}name.png")
......
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