aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/validations/length_validation_test.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-08-06 18:38:23 +0200
committerXavier Noria <fxn@hashref.com>2016-08-06 18:38:23 +0200
commit4c208254573c3428d82bd8744860bd86e1c78acb (patch)
tree9c8194acb75552fdda62d527d5c2876da9161650 /activemodel/test/cases/validations/length_validation_test.rb
parent18a2513729ab90b04b1c86963e7d5b9213270c81 (diff)
downloadrails-4c208254573c3428d82bd8744860bd86e1c78acb.tar.gz
rails-4c208254573c3428d82bd8744860bd86e1c78acb.tar.bz2
rails-4c208254573c3428d82bd8744860bd86e1c78acb.zip
applies new string literal convention in activemodel/test
The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
Diffstat (limited to 'activemodel/test/cases/validations/length_validation_test.rb')
-rw-r--r--activemodel/test/cases/validations/length_validation_test.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/activemodel/test/cases/validations/length_validation_test.rb b/activemodel/test/cases/validations/length_validation_test.rb
index 11dce1df20..dbbfb8351b 100644
--- a/activemodel/test/cases/validations/length_validation_test.rb
+++ b/activemodel/test/cases/validations/length_validation_test.rb
@@ -1,7 +1,7 @@
-require 'cases/helper'
+require "cases/helper"
-require 'models/topic'
-require 'models/person'
+require "models/topic"
+require "models/person"
class LengthValidationTest < ActiveModel::TestCase
def teardown
@@ -125,7 +125,7 @@ class LengthValidationTest < ActiveModel::TestCase
def test_optionally_validates_length_of_using_within
Topic.validates_length_of :title, :content, within: 3..5, allow_nil: true
- t = Topic.new('title' => 'abc', 'content' => 'abcd')
+ t = Topic.new("title" => "abc", "content" => "abcd")
assert t.valid?
t.title = nil
@@ -228,17 +228,17 @@ class LengthValidationTest < ActiveModel::TestCase
end
def test_validates_length_of_custom_errors_for_both_too_short_and_too_long
- Topic.validates_length_of :title, minimum: 3, maximum: 5, too_short: 'too short', too_long: 'too long'
+ Topic.validates_length_of :title, minimum: 3, maximum: 5, too_short: "too short", too_long: "too long"
- t = Topic.new(title: 'a')
+ t = Topic.new(title: "a")
assert t.invalid?
assert t.errors[:title].any?
- assert_equal ['too short'], t.errors['title']
+ assert_equal ["too short"], t.errors["title"]
- t = Topic.new(title: 'aaaaaa')
+ t = Topic.new(title: "aaaaaa")
assert t.invalid?
assert t.errors[:title].any?
- assert_equal ['too long'], t.errors['title']
+ assert_equal ["too long"], t.errors["title"]
end
def test_validates_length_of_custom_errors_for_is_with_message