aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-08-06 19:55:02 +0200
committerXavier Noria <fxn@hashref.com>2016-08-06 20:16:27 +0200
commit80e66cc4d90bf8c15d1a5f6e3152e90147f00772 (patch)
treee7e75464af04f3cf1935b29238dbd7cb2337b0dd /activemodel/test/cases
parent411ccbdab2608c62aabdb320d52cb02d446bb39c (diff)
downloadrails-80e66cc4d90bf8c15d1a5f6e3152e90147f00772.tar.gz
rails-80e66cc4d90bf8c15d1a5f6e3152e90147f00772.tar.bz2
rails-80e66cc4d90bf8c15d1a5f6e3152e90147f00772.zip
normalizes indentation and whitespace across the project
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r--activemodel/test/cases/attribute_assignment_test.rb2
-rw-r--r--activemodel/test/cases/attribute_methods_test.rb4
-rw-r--r--activemodel/test/cases/forbidden_attributes_protection_test.rb2
-rw-r--r--activemodel/test/cases/translation_test.rb1
-rw-r--r--activemodel/test/cases/types_test.rb14
-rw-r--r--activemodel/test/cases/validations/numericality_validation_test.rb34
6 files changed, 28 insertions, 29 deletions
diff --git a/activemodel/test/cases/attribute_assignment_test.rb b/activemodel/test/cases/attribute_assignment_test.rb
index 287bea719c..8eb389d331 100644
--- a/activemodel/test/cases/attribute_assignment_test.rb
+++ b/activemodel/test/cases/attribute_assignment_test.rb
@@ -18,7 +18,7 @@ class AttributeAssignmentTest < ActiveModel::TestCase
protected
- attr_writer :metadata
+ attr_writer :metadata
end
class ErrorFromAttributeWriter < StandardError
diff --git a/activemodel/test/cases/attribute_methods_test.rb b/activemodel/test/cases/attribute_methods_test.rb
index 676459cc8e..f59180cceb 100644
--- a/activemodel/test/cases/attribute_methods_test.rb
+++ b/activemodel/test/cases/attribute_methods_test.rb
@@ -245,8 +245,8 @@ class AttributeMethodsTest < ActiveModel::TestCase
class ClassWithProtected
protected
- def protected_method
- end
+ def protected_method
+ end
end
test "should not interfere with respond_to? if the attribute has a private/protected method" do
diff --git a/activemodel/test/cases/forbidden_attributes_protection_test.rb b/activemodel/test/cases/forbidden_attributes_protection_test.rb
index fdd349a0fb..d8cc72e662 100644
--- a/activemodel/test/cases/forbidden_attributes_protection_test.rb
+++ b/activemodel/test/cases/forbidden_attributes_protection_test.rb
@@ -37,6 +37,6 @@ class ActiveModelMassUpdateProtectionTest < ActiveSupport::TestCase
end
test "regular attributes should still be allowed" do
- assert_equal({ a: "b" }, Account.new.sanitize_for_mass_assignment(a: "b"))
+ assert_equal({ a: "b" }, Account.new.sanitize_for_mass_assignment(a: "b"))
end
end
diff --git a/activemodel/test/cases/translation_test.rb b/activemodel/test/cases/translation_test.rb
index 69a3acd957..37d68de014 100644
--- a/activemodel/test/cases/translation_test.rb
+++ b/activemodel/test/cases/translation_test.rb
@@ -110,4 +110,3 @@ class ActiveModelI18nTests < ActiveModel::TestCase
assert_equal({ default: "Cool gender" }, options)
end
end
-
diff --git a/activemodel/test/cases/types_test.rb b/activemodel/test/cases/types_test.rb
index 900afe836a..c46775cb41 100644
--- a/activemodel/test/cases/types_test.rb
+++ b/activemodel/test/cases/types_test.rb
@@ -114,12 +114,12 @@ module ActiveModel
private
- def with_timezone_config(default:)
- old_zone_default = ::Time.zone_default
- ::Time.zone_default = ::Time.find_zone(default)
- yield
- ensure
- ::Time.zone_default = old_zone_default
- end
+ def with_timezone_config(default:)
+ old_zone_default = ::Time.zone_default
+ ::Time.zone_default = ::Time.find_zone(default)
+ yield
+ ensure
+ ::Time.zone_default = old_zone_default
+ end
end
end
diff --git a/activemodel/test/cases/validations/numericality_validation_test.rb b/activemodel/test/cases/validations/numericality_validation_test.rb
index 742a9fc679..56127f9286 100644
--- a/activemodel/test/cases/validations/numericality_validation_test.rb
+++ b/activemodel/test/cases/validations/numericality_validation_test.rb
@@ -94,7 +94,7 @@ class NumericalityValidationTest < ActiveModel::TestCase
end
def test_validates_numericality_with_greater_than_or_equal_using_differing_numeric_types
- Topic.validates_numericality_of :approved, greater_than_or_equal_to: BigDecimal.new("97.18")
+ Topic.validates_numericality_of :approved, greater_than_or_equal_to: BigDecimal.new("97.18")
invalid!([-97.18, 97.17, 97, BigDecimal.new("97.17"), BigDecimal.new("-97.18")], "must be greater than or equal to 97.18")
valid!([97.18, 98, BigDecimal.new("97.19")])
@@ -264,25 +264,25 @@ class NumericalityValidationTest < ActiveModel::TestCase
private
- def invalid!(values, error = nil)
- with_each_topic_approved_value(values) do |topic, value|
- assert topic.invalid?, "#{value.inspect} not rejected as a number"
- assert topic.errors[:approved].any?, "FAILED for #{value.inspect}"
- assert_equal error, topic.errors[:approved].first if error
+ def invalid!(values, error = nil)
+ with_each_topic_approved_value(values) do |topic, value|
+ assert topic.invalid?, "#{value.inspect} not rejected as a number"
+ assert topic.errors[:approved].any?, "FAILED for #{value.inspect}"
+ assert_equal error, topic.errors[:approved].first if error
+ end
end
- end
- def valid!(values)
- with_each_topic_approved_value(values) do |topic, value|
- assert topic.valid?, "#{value.inspect} not accepted as a number with validation error: #{topic.errors[:approved].first}"
+ def valid!(values)
+ with_each_topic_approved_value(values) do |topic, value|
+ assert topic.valid?, "#{value.inspect} not accepted as a number with validation error: #{topic.errors[:approved].first}"
+ end
end
- end
- def with_each_topic_approved_value(values)
- topic = Topic.new(title: "numeric test", content: "whatever")
- values.each do |value|
- topic.approved = value
- yield topic, value
+ def with_each_topic_approved_value(values)
+ topic = Topic.new(title: "numeric test", content: "whatever")
+ values.each do |value|
+ topic.approved = value
+ yield topic, value
+ end
end
- end
end