Skip to content

Commit

Permalink
Revert "Remove trailing whitespaces"
Browse files Browse the repository at this point in the history
This reverts commit 90c887f.
  • Loading branch information
Florent Guilleux committed Dec 1, 2012
1 parent 90c887f commit 8dc4041
Show file tree
Hide file tree
Showing 28 changed files with 61 additions and 59 deletions.
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/metal/mime_responds.rb
Expand Up @@ -259,7 +259,7 @@ def respond_to(*mimes, &block)
# * for other requests - i.e. data formats such as xml, json, csv etc, if
# the resource passed to +respond_with+ responds to <code>to_<format></code>,
# the method attempts to render the resource in the requested format
# directly, e.g. for an xml request, the response is equivalent to calling
# directly, e.g. for an xml request, the response is equivalent to calling
# <code>render xml: resource</code>.
#
# === Nested resources
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/middleware/flash.rb
Expand Up @@ -82,7 +82,7 @@ def self.from_session_value(value)
else
new
end

flash.tap(&:sweep)
end

Expand Down
4 changes: 2 additions & 2 deletions activemodel/test/cases/validations/format_validation_test.rb
Expand Up @@ -68,11 +68,11 @@ def test_validate_format_with_formatted_message
assert t.invalid?
assert_equal ["can't be Invalid title"], t.errors[:title]
end

def test_validate_format_of_with_multiline_regexp_should_raise_error
assert_raise(ArgumentError) { Topic.validates_format_of(:title, :with => /^Valid Title$/) }
end

def test_validate_format_of_with_multiline_regexp_and_option
assert_nothing_raised(ArgumentError) do
Topic.validates_format_of(:title, :with => /^Valid Title$/, :multiline => true)
Expand Down
2 changes: 1 addition & 1 deletion activemodel/test/models/oauthed_user.rb
Expand Up @@ -2,7 +2,7 @@ class OauthedUser
extend ActiveModel::Callbacks
include ActiveModel::Validations
include ActiveModel::SecurePassword

define_model_callbacks :create

has_secure_password(validations: false)
Expand Down
2 changes: 1 addition & 1 deletion activemodel/test/models/user.rb
Expand Up @@ -2,7 +2,7 @@ class User
extend ActiveModel::Callbacks
include ActiveModel::Validations
include ActiveModel::SecurePassword

define_model_callbacks :create

has_secure_password
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/log_subscriber.rb
@@ -1,7 +1,7 @@
module ActiveRecord
class LogSubscriber < ActiveSupport::LogSubscriber
IGNORE_PAYLOAD_NAMES = ["SCHEMA", "EXPLAIN"]

def self.runtime=(value)
Thread.current[:active_record_sql_runtime] = value
end
Expand Down
4 changes: 2 additions & 2 deletions activerecord/test/cases/associations/eager_test.rb
Expand Up @@ -984,10 +984,10 @@ def test_preload_has_many_with_association_condition_and_default_scope
post = Post.create!(:title => 'Beaches', :body => "I like beaches!")
Reader.create! :person => people(:david), :post => post
LazyReader.create! :person => people(:susan), :post => post

assert_equal 1, post.lazy_readers.to_a.size
assert_equal 2, post.lazy_readers_skimmers_or_not.to_a.size

post_with_readers = Post.includes(:lazy_readers_skimmers_or_not).find(post.id)
assert_equal 2, post_with_readers.lazy_readers_skimmers_or_not.to_a.size
end
Expand Down
4 changes: 2 additions & 2 deletions activerecord/test/cases/primary_keys_test.rb
Expand Up @@ -204,15 +204,15 @@ def test_set_primary_key_with_no_connection
if current_adapter?(:MysqlAdapter) or current_adapter?(:Mysql2Adapter)
class PrimaryKeyWithAnsiQuotesTest < ActiveRecord::TestCase
self.use_transactional_fixtures = false

def test_primaery_key_method_with_ansi_quotes
con = ActiveRecord::Base.connection
con.execute("SET SESSION sql_mode='ANSI_QUOTES'")
assert_equal "id", con.primary_key("topics")
ensure
con.reconnect!
end

end
end

6 changes: 3 additions & 3 deletions activerecord/test/cases/tasks/database_tasks_test.rb
Expand Up @@ -32,7 +32,7 @@ def structure_dump(filename); end
ActiveRecord::Tasks::DatabaseTasks.structure_dump({'adapter' => :foo}, "awesome-file.sql")
end
end

class DatabaseTasksCreateTest < ActiveRecord::TestCase
include DatabaseTasksSetupper

Expand Down Expand Up @@ -258,7 +258,7 @@ class DatabaseTasksPurgeTest < ActiveRecord::TestCase

class DatabaseTasksCharsetTest < ActiveRecord::TestCase
include DatabaseTasksSetupper

ADAPTERS_TASKS.each do |k, v|
define_method("test_#{k}_charset") do
eval("@#{v}").expects(:charset)
Expand All @@ -269,7 +269,7 @@ class DatabaseTasksCharsetTest < ActiveRecord::TestCase

class DatabaseTasksCollationTest < ActiveRecord::TestCase
include DatabaseTasksSetupper

ADAPTERS_TASKS.each do |k, v|
define_method("test_#{k}_collation") do
eval("@#{v}").expects(:collation)
Expand Down
Expand Up @@ -341,15 +341,15 @@ def test_validate_straight_inheritance_uniqueness
assert w6.errors[:city].any?, "Should have errors for city"
assert_equal ["has already been taken"], w6.errors[:city], "Should have uniqueness message for city"
end

def test_validate_uniqueness_with_conditions
Topic.validates_uniqueness_of(:title, :conditions => Topic.where('approved = ?', true))
Topic.create("title" => "I'm a topic", "approved" => true)
Topic.create("title" => "I'm an unapproved topic", "approved" => false)

t3 = Topic.new("title" => "I'm a topic", "approved" => true)
assert !t3.valid?, "t3 shouldn't be valid"

t4 = Topic.new("title" => "I'm an unapproved topic", "approved" => false)
assert t4.valid?, "t4 should be valid"
end
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/models/eye.rb
Expand Up @@ -15,7 +15,7 @@ class Eye < ActiveRecord::Base
after_create :trace_after_create2
after_update :trace_after_update2
after_save :trace_after_save2

def trace_after_create
(@after_create_callbacks_stack ||= []) << !iris.persisted?
end
Expand Down
2 changes: 1 addition & 1 deletion activesupport/lib/active_support/gzip.rb
Expand Up @@ -9,7 +9,7 @@ module ActiveSupport
# # => "\x1F\x8B\b\x00o\x8D\xCDO\x00\x03K\xCE\xCF-(J-.V\xC8MU\x04\x00R>n\x83\f\x00\x00\x00"
#
# ActiveSupport::Gzip.decompress(gzip)
# # => "compress me!"
# # => "compress me!"
module Gzip
class Stream < StringIO
def initialize(*)
Expand Down
10 changes: 5 additions & 5 deletions activesupport/test/callbacks_test.rb
Expand Up @@ -297,7 +297,7 @@ def save
end
end
end

class AroundPersonResult < MySuper
attr_reader :result

Expand All @@ -308,15 +308,15 @@ class AroundPersonResult < MySuper
def tweedle_dum
@result = yield
end

def tweedle_1
:tweedle_1
end

def tweedle_2
:tweedle_2
end

def save
run_callbacks :save do
:running
Expand Down Expand Up @@ -410,7 +410,7 @@ def test_save_around
], around.history
end
end

class AroundCallbackResultTest < ActiveSupport::TestCase
def test_save_around
around = AroundPersonResult.new
Expand Down Expand Up @@ -709,5 +709,5 @@ def test_per_key_option_deprecaton
end
end
end

end
2 changes: 1 addition & 1 deletion activesupport/test/core_ext/bigdecimal_test.rb
Expand Up @@ -14,7 +14,7 @@ def test_to_d
bd = BigDecimal.new '10'
assert_equal bd, bd.to_d
end

def test_to_s
bd = BigDecimal.new '0.01'
assert_equal '0.01', bd.to_s
Expand Down
2 changes: 1 addition & 1 deletion activesupport/test/core_ext/duration_test.rb
Expand Up @@ -131,7 +131,7 @@ def test_adding_day_across_dst_boundary
assert_equal Time.local(2009,3,29,0,0,0) + 1.day, Time.local(2009,3,30,0,0,0)
end
end

def test_delegation_with_block_works
counter = 0
assert_nothing_raised do
Expand Down
8 changes: 4 additions & 4 deletions activesupport/test/core_ext/module/remove_method_test.rb
Expand Up @@ -6,24 +6,24 @@ class A
def do_something
return 1
end

end
end

class RemoveMethodTest < ActiveSupport::TestCase

def test_remove_method_from_an_object
RemoveMethodTests::A.class_eval{
self.remove_possible_method(:do_something)
}
assert !RemoveMethodTests::A.new.respond_to?(:do_something)
end

def test_redefine_method_in_an_object
RemoveMethodTests::A.class_eval{
self.redefine_method(:do_something) { return 100 }
}
assert_equal 100, RemoveMethodTests::A.new.do_something
end

end
end
18 changes: 10 additions & 8 deletions activesupport/test/core_ext/numeric_ext_test.rb
Expand Up @@ -203,7 +203,7 @@ def gigabytes(number)
def terabytes(number)
gigabytes(number) * 1024
end

def test_to_s__phone
assert_equal("555-1234", 5551234.to_s(:phone))
assert_equal("800-555-1212", 8005551212.to_s(:phone))
Expand All @@ -217,7 +217,7 @@ def test_to_s__phone
assert_equal("22-555-1212", 225551212.to_s(:phone))
assert_equal("+45-22-555-1212", 225551212.to_s(:phone, :country_code => 45))
end

def test_to_s__currency
assert_equal("$1,234,567,890.50", 1234567890.50.to_s(:currency))
assert_equal("$1,234,567,890.51", 1234567890.506.to_s(:currency))
Expand All @@ -228,7 +228,8 @@ def test_to_s__currency
assert_equal("$1,234,567,890.5", 1234567890.50.to_s(:currency, :precision => 1))
assert_equal("&pound;1234567890,50", 1234567890.50.to_s(:currency, :unit => "&pound;", :separator => ",", :delimiter => ""))
end



def test_to_s__rounded
assert_equal("-111.235", -111.2346.to_s(:rounded))
assert_equal("111.235", 111.2346.to_s(:rounded))
Expand All @@ -245,7 +246,7 @@ def test_to_s__rounded
assert_equal("11.00", 10.995.to_s(:rounded, :precision => 2))
assert_equal("0.00", -0.001.to_s(:rounded, :precision => 2))
end

def test_to_s__percentage
assert_equal("100.000%", 100.to_s(:percentage))
assert_equal("100%", 100.to_s(:percentage, :precision => 0))
Expand Down Expand Up @@ -273,6 +274,7 @@ def test_to_s__delimited__with_options_hash
assert_equal '12.345.678,05', 12345678.05.to_s(:delimited, :separator => ',', :delimiter => '.')
assert_equal '12.345.678,05', 12345678.05.to_s(:delimited, :delimiter => '.', :separator => ',')
end


def test_to_s__rounded_with_custom_delimiter_and_separator
assert_equal '31,83', 31.825.to_s(:rounded, :precision => 2, :separator => ',')
Expand Down Expand Up @@ -348,7 +350,7 @@ def test_to_s__human_size_with_si_prefix
assert_equal '1.23 GB', 1234567890.to_s(:human_size, :prefix => :si)
assert_equal '1.23 TB', 1234567890123.to_s(:human_size, :prefix => :si)
end

def test_to_s__human_size_with_options_hash
assert_equal '1.2 MB', 1234567.to_s(:human_size, :precision => 2)
assert_equal '3 Bytes', 3.14159265.to_s(:human_size, :precision => 4)
Expand All @@ -364,13 +366,13 @@ def test_to_s__human_size_with_options_hash
assert_equal '1.012 KB', kilobytes(1.0123).to_s(:human_size, :precision => 3, :significant => false)
assert_equal '1 KB', kilobytes(1.0123).to_s(:human_size, :precision => 0, :significant => true) #ignores significant it precision is 0
end

def test_to_s__human_size_with_custom_delimiter_and_separator
assert_equal '1,01 KB', kilobytes(1.0123).to_s(:human_size, :precision => 3, :separator => ',')
assert_equal '1,01 KB', kilobytes(1.0100).to_s(:human_size, :precision => 4, :separator => ',')
assert_equal '1.000,1 TB', terabytes(1000.1).to_s(:human_size, :precision => 5, :delimiter => '.', :separator => ',')
end

def test_number_to_human
assert_equal '-123', -123.to_s(:human)
assert_equal '-0.5', -0.5.to_s(:human)
Expand Down Expand Up @@ -434,7 +436,7 @@ def test_number_to_human_with_custom_format
def test_to_s__injected_on_proper_types
assert_equal Fixnum, 1230.class
assert_equal '1.23 Thousand', 1230.to_s(:human)

assert_equal Float, Float(1230).class
assert_equal '1.23 Thousand', Float(1230).to_s(:human)

Expand Down
6 changes: 3 additions & 3 deletions activesupport/test/core_ext/object/inclusion_test.rb
Expand Up @@ -6,12 +6,12 @@ def test_in_multiple_args
assert :b.in?(:a,:b)
assert !:c.in?(:a,:b)
end

def test_in_multiple_arrays
assert [1,2].in?([1,2],[2,3])
assert ![1,2].in?([1,3],[2,1])
end

def test_in_array
assert 1.in?([1,2])
assert !3.in?([1,2])
Expand Down Expand Up @@ -53,7 +53,7 @@ def test_in_module
assert A.in?(C)
assert !A.in?(A)
end

def test_no_method_catching
assert_raise(ArgumentError) { 1.in?(1) }
end
Expand Down
2 changes: 1 addition & 1 deletion activesupport/test/core_ext/object_and_class_ext_test.rb
Expand Up @@ -162,7 +162,7 @@ def private_method

assert_raise(NoMethodError) { klass.new.try!(:private_method) }
end

def test_try_with_private_method
klass = Class.new do
private
Expand Down
4 changes: 2 additions & 2 deletions activesupport/test/deprecation_test.rb
Expand Up @@ -254,10 +254,10 @@ def test_deprecated_constant_with_deprecator_given
klass::OLD.to_s
end
end

def test_deprecated_instance_variable_with_instance_deprecator
deprecator = deprecator_with_messages

klass = Class.new() do
def initialize(deprecator)
@request = ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(self, :request, :@request, deprecator)
Expand Down
2 changes: 1 addition & 1 deletion activesupport/test/inflector_test.rb
Expand Up @@ -361,7 +361,7 @@ def test_inflector_locality

inflect.singular(/s$/, '')
inflect.singular(/es$/, '')

inflect.irregular('el', 'los')
end

Expand Down

0 comments on commit 8dc4041

Please sign in to comment.