mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove extra whitespace
This commit is contained in:
parent
82c39e1a0b
commit
fda1863e1a
15 changed files with 95 additions and 95 deletions
|
@ -367,14 +367,14 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
|
|||
# in Oracle '' is saved as null therefore need to save ' ' in not null column
|
||||
post = categories(:general).post_with_conditions.build(body: " ")
|
||||
|
||||
assert post.save
|
||||
assert_equal "Yet Another Testing Title", post.title
|
||||
assert post.save
|
||||
assert_equal "Yet Another Testing Title", post.title
|
||||
|
||||
# in Oracle '' is saved as null therefore need to save ' ' in not null column
|
||||
another_post = categories(:general).post_with_conditions.create(body: " ")
|
||||
|
||||
assert_predicate another_post, :persisted?
|
||||
assert_equal "Yet Another Testing Title", another_post.title
|
||||
assert_predicate another_post, :persisted?
|
||||
assert_equal "Yet Another Testing Title", another_post.title
|
||||
end
|
||||
|
||||
def test_distinct_after_the_fact
|
||||
|
@ -557,18 +557,18 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
|
|||
developer = project.developers.first
|
||||
|
||||
project.reload
|
||||
assert_not_predicate project.developers, :loaded?
|
||||
assert_not_predicate project.developers, :loaded?
|
||||
assert_queries(1) do
|
||||
assert_includes project.developers, developer
|
||||
end
|
||||
assert_not_predicate project.developers, :loaded?
|
||||
assert_not_predicate project.developers, :loaded?
|
||||
end
|
||||
|
||||
def test_include_returns_false_for_non_matching_record_to_verify_scoping
|
||||
project = projects(:active_record)
|
||||
developer = Developer.create name: "Bryan", salary: 50_000
|
||||
|
||||
assert_not_predicate project.developers, :loaded?
|
||||
assert_not_predicate project.developers, :loaded?
|
||||
assert ! project.developers.include?(developer)
|
||||
end
|
||||
|
||||
|
|
|
@ -713,13 +713,13 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
|
|||
def test_find_each
|
||||
firm = companies(:first_firm)
|
||||
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
|
||||
assert_queries(4) do
|
||||
firm.clients.find_each(batch_size: 1) { |c| assert_equal firm.id, c.firm_id }
|
||||
end
|
||||
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
end
|
||||
|
||||
def test_find_each_with_conditions
|
||||
|
@ -732,13 +732,13 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
end
|
||||
|
||||
def test_find_in_batches
|
||||
firm = companies(:first_firm)
|
||||
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
|
||||
assert_queries(2) do
|
||||
firm.clients.find_in_batches(batch_size: 2) do |clients|
|
||||
|
@ -746,7 +746,7 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
end
|
||||
|
||||
def test_find_all_sanitized
|
||||
|
@ -1441,13 +1441,13 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
|
|||
def test_creation_respects_hash_condition
|
||||
ms_client = companies(:first_firm).clients_like_ms_with_hash_conditions.build
|
||||
|
||||
assert ms_client.save
|
||||
assert_equal "Microsoft", ms_client.name
|
||||
assert ms_client.save
|
||||
assert_equal "Microsoft", ms_client.name
|
||||
|
||||
another_ms_client = companies(:first_firm).clients_like_ms_with_hash_conditions.create
|
||||
|
||||
assert_predicate another_ms_client, :persisted?
|
||||
assert_equal "Microsoft", another_ms_client.name
|
||||
assert_predicate another_ms_client, :persisted?
|
||||
assert_equal "Microsoft", another_ms_client.name
|
||||
end
|
||||
|
||||
def test_clearing_without_initial_access
|
||||
|
@ -1869,18 +1869,18 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
|
|||
client = firm.clients.first
|
||||
|
||||
firm.reload
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
assert_queries(1) do
|
||||
assert_equal true, firm.clients.include?(client)
|
||||
end
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
end
|
||||
|
||||
def test_include_returns_false_for_non_matching_record_to_verify_scoping
|
||||
firm = companies(:first_firm)
|
||||
client = Client.create!(name: "Not Associated")
|
||||
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
assert_not_predicate firm.clients, :loaded?
|
||||
assert_equal false, firm.clients.include?(client)
|
||||
end
|
||||
|
||||
|
@ -2055,7 +2055,7 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
|
|||
|
||||
def test_calling_one_should_return_false_if_zero
|
||||
firm = companies(:another_firm)
|
||||
assert_not_predicate firm.clients_like_ms, :one?
|
||||
assert_not_predicate firm.clients_like_ms, :one?
|
||||
assert_equal 0, firm.clients_like_ms.size
|
||||
end
|
||||
|
||||
|
@ -2067,7 +2067,7 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
|
|||
|
||||
def test_calling_one_should_return_false_if_more_than_one
|
||||
firm = companies(:first_firm)
|
||||
assert_not_predicate firm.clients, :one?
|
||||
assert_not_predicate firm.clients, :one?
|
||||
assert_equal 3, firm.clients.size
|
||||
end
|
||||
|
||||
|
|
|
@ -433,7 +433,7 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
|
|||
|
||||
def test_create_respects_hash_condition
|
||||
account = companies(:first_firm).create_account_limit_500_with_hash_conditions
|
||||
assert_predicate account, :persisted?
|
||||
assert_predicate account, :persisted?
|
||||
assert_equal 500, account.credit_limit
|
||||
end
|
||||
|
||||
|
|
|
@ -720,18 +720,18 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase
|
|||
category = david.categories.first
|
||||
|
||||
david.reload
|
||||
assert_not_predicate david.categories, :loaded?
|
||||
assert_not_predicate david.categories, :loaded?
|
||||
assert_queries(1) do
|
||||
assert_includes david.categories, category
|
||||
end
|
||||
assert_not_predicate david.categories, :loaded?
|
||||
assert_not_predicate david.categories, :loaded?
|
||||
end
|
||||
|
||||
def test_has_many_through_include_returns_false_for_non_matching_record_to_verify_scoping
|
||||
david = authors(:david)
|
||||
category = Category.create!(name: "Not Associated")
|
||||
|
||||
assert_not_predicate david.categories, :loaded?
|
||||
assert_not_predicate david.categories, :loaded?
|
||||
assert ! david.categories.include?(category)
|
||||
end
|
||||
|
||||
|
|
|
@ -453,7 +453,7 @@ class EnumTest < ActiveRecord::TestCase
|
|||
end
|
||||
|
||||
test "query state by predicate with custom suffix" do
|
||||
assert_predicate @book, :medium_to_read?
|
||||
assert_predicate @book, :medium_to_read?
|
||||
assert_not_predicate @book, :easy_to_read?
|
||||
assert_not_predicate @book, :hard_to_read?
|
||||
end
|
||||
|
@ -475,18 +475,18 @@ class EnumTest < ActiveRecord::TestCase
|
|||
test "update enum attributes with custom suffix" do
|
||||
@book.medium_to_read!
|
||||
assert_not_predicate @book, :easy_to_read?
|
||||
assert_predicate @book, :medium_to_read?
|
||||
assert_predicate @book, :medium_to_read?
|
||||
assert_not_predicate @book, :hard_to_read?
|
||||
|
||||
@book.easy_to_read!
|
||||
assert_predicate @book, :easy_to_read?
|
||||
assert_predicate @book, :easy_to_read?
|
||||
assert_not_predicate @book, :medium_to_read?
|
||||
assert_not_predicate @book, :hard_to_read?
|
||||
|
||||
@book.hard_to_read!
|
||||
assert_not_predicate @book, :easy_to_read?
|
||||
assert_not_predicate @book, :medium_to_read?
|
||||
assert_predicate @book, :hard_to_read?
|
||||
assert_predicate @book, :hard_to_read?
|
||||
end
|
||||
|
||||
test "uses default status when no status is provided in fixtures" do
|
||||
|
|
|
@ -632,10 +632,10 @@ module NestedAttributesOnACollectionAssociationTests
|
|||
def test_should_not_load_association_when_updating_existing_records
|
||||
@pirate.reload
|
||||
@pirate.send(association_setter, [{ id: @child_1.id, name: "Grace OMalley" }])
|
||||
assert_not_predicate @pirate.send(@association_name), :loaded?
|
||||
assert_not_predicate @pirate.send(@association_name), :loaded?
|
||||
|
||||
@pirate.save
|
||||
assert_not_predicate @pirate.send(@association_name), :loaded?
|
||||
assert_not_predicate @pirate.send(@association_name), :loaded?
|
||||
assert_equal "Grace OMalley", @child_1.reload.name
|
||||
end
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ class PersistenceTest < ActiveRecord::TestCase
|
|||
def test_destroy_all
|
||||
conditions = "author_name = 'Mary'"
|
||||
topics_by_mary = Topic.all.merge!(where: conditions, order: "id").to_a
|
||||
assert_not_empty topics_by_mary
|
||||
assert_not_empty topics_by_mary
|
||||
|
||||
assert_difference("Topic.count", -topics_by_mary.size) do
|
||||
destroyed = Topic.where(conditions).destroy_all.sort_by(&:id)
|
||||
|
|
|
@ -108,7 +108,7 @@ class RelationTest < ActiveRecord::TestCase
|
|||
2.times { assert_equal "The First Topic", topics.first.title }
|
||||
end
|
||||
|
||||
assert_not_predicate topics, :loaded?
|
||||
assert_not_predicate topics, :loaded?
|
||||
end
|
||||
|
||||
def test_loaded_first
|
||||
|
@ -875,7 +875,7 @@ class RelationTest < ActiveRecord::TestCase
|
|||
davids = Author.where(name: "David")
|
||||
|
||||
assert_difference("Author.count", -1) { davids.delete_all }
|
||||
assert_not_predicate davids, :loaded?
|
||||
assert_not_predicate davids, :loaded?
|
||||
end
|
||||
|
||||
def test_delete_all_loaded
|
||||
|
@ -1006,7 +1006,7 @@ class RelationTest < ActiveRecord::TestCase
|
|||
posts = Post.all
|
||||
|
||||
assert_queries(1) { assert_equal 11, posts.size }
|
||||
assert_not_predicate posts, :loaded?
|
||||
assert_not_predicate posts, :loaded?
|
||||
|
||||
best_posts = posts.where(comments_count: 0)
|
||||
best_posts.load # force load
|
||||
|
@ -1017,7 +1017,7 @@ class RelationTest < ActiveRecord::TestCase
|
|||
posts = Post.limit(10)
|
||||
|
||||
assert_queries(1) { assert_equal 10, posts.size }
|
||||
assert_not_predicate posts, :loaded?
|
||||
assert_not_predicate posts, :loaded?
|
||||
|
||||
best_posts = posts.where(comments_count: 0)
|
||||
best_posts.load # force load
|
||||
|
@ -1028,7 +1028,7 @@ class RelationTest < ActiveRecord::TestCase
|
|||
posts = Post.limit(0)
|
||||
|
||||
assert_no_queries { assert_equal 0, posts.size }
|
||||
assert_not_predicate posts, :loaded?
|
||||
assert_not_predicate posts, :loaded?
|
||||
|
||||
posts.load # force load
|
||||
assert_no_queries { assert_equal 0, posts.size }
|
||||
|
@ -1038,7 +1038,7 @@ class RelationTest < ActiveRecord::TestCase
|
|||
posts = Post.limit(0)
|
||||
|
||||
assert_no_queries { assert_equal true, posts.empty? }
|
||||
assert_not_predicate posts, :loaded?
|
||||
assert_not_predicate posts, :loaded?
|
||||
end
|
||||
|
||||
def test_count_complex_chained_relations
|
||||
|
@ -1052,11 +1052,11 @@ class RelationTest < ActiveRecord::TestCase
|
|||
posts = Post.all
|
||||
|
||||
assert_queries(1) { assert_equal false, posts.empty? }
|
||||
assert_not_predicate posts, :loaded?
|
||||
assert_not_predicate posts, :loaded?
|
||||
|
||||
no_posts = posts.where(title: "")
|
||||
assert_queries(1) { assert_equal true, no_posts.empty? }
|
||||
assert_not_predicate no_posts, :loaded?
|
||||
assert_not_predicate no_posts, :loaded?
|
||||
|
||||
best_posts = posts.where(comments_count: 0)
|
||||
best_posts.load # force load
|
||||
|
@ -1067,11 +1067,11 @@ class RelationTest < ActiveRecord::TestCase
|
|||
posts = Post.select("comments_count").where("id is not null").group("author_id").where("comments_count > 0")
|
||||
|
||||
assert_queries(1) { assert_equal false, posts.empty? }
|
||||
assert_not_predicate posts, :loaded?
|
||||
assert_not_predicate posts, :loaded?
|
||||
|
||||
no_posts = posts.where(title: "")
|
||||
assert_queries(1) { assert_equal true, no_posts.empty? }
|
||||
assert_not_predicate no_posts, :loaded?
|
||||
assert_not_predicate no_posts, :loaded?
|
||||
end
|
||||
|
||||
def test_any
|
||||
|
@ -1087,7 +1087,7 @@ class RelationTest < ActiveRecord::TestCase
|
|||
|
||||
assert_queries(3) do
|
||||
assert posts.any? # Uses COUNT()
|
||||
assert_not_predicate posts.where(id: nil), :any?
|
||||
assert_not_predicate posts.where(id: nil), :any?
|
||||
|
||||
assert posts.any? { |p| p.id > 0 }
|
||||
assert ! posts.any? { |p| p.id <= 0 }
|
||||
|
@ -1112,7 +1112,7 @@ class RelationTest < ActiveRecord::TestCase
|
|||
posts = Post.all
|
||||
|
||||
assert_predicate posts, :many?
|
||||
assert_not_predicate posts.limit(1), :many?
|
||||
assert_not_predicate posts.limit(1), :many?
|
||||
end
|
||||
|
||||
def test_none?
|
||||
|
@ -1121,7 +1121,7 @@ class RelationTest < ActiveRecord::TestCase
|
|||
assert ! posts.none? # Uses COUNT()
|
||||
end
|
||||
|
||||
assert_not_predicate posts, :loaded?
|
||||
assert_not_predicate posts, :loaded?
|
||||
|
||||
assert_queries(1) do
|
||||
assert posts.none? { |p| p.id < 0 }
|
||||
|
@ -1137,7 +1137,7 @@ class RelationTest < ActiveRecord::TestCase
|
|||
assert ! posts.one? # Uses COUNT()
|
||||
end
|
||||
|
||||
assert_not_predicate posts, :loaded?
|
||||
assert_not_predicate posts, :loaded?
|
||||
|
||||
assert_queries(1) do
|
||||
assert ! posts.one? { |p| p.id < 3 }
|
||||
|
|
|
@ -65,7 +65,7 @@ module CacheStoreVersionBehavior
|
|||
m1v2 = ModelWithKeyAndVersion.new("model/1", 2)
|
||||
|
||||
@cache.write(m1v1, "bar")
|
||||
assert @cache.exist?(m1v1)
|
||||
assert @cache.exist?(m1v1)
|
||||
assert_not @cache.fetch(m1v2)
|
||||
end
|
||||
|
||||
|
|
|
@ -363,45 +363,45 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_compare_with_time
|
||||
assert_equal 1, DateTime.civil(2000) <=> Time.utc(1999, 12, 31, 23, 59, 59)
|
||||
assert_equal 0, DateTime.civil(2000) <=> Time.utc(2000, 1, 1, 0, 0, 0)
|
||||
assert_equal 1, DateTime.civil(2000) <=> Time.utc(1999, 12, 31, 23, 59, 59)
|
||||
assert_equal 0, DateTime.civil(2000) <=> Time.utc(2000, 1, 1, 0, 0, 0)
|
||||
assert_equal(-1, DateTime.civil(2000) <=> Time.utc(2000, 1, 1, 0, 0, 1))
|
||||
end
|
||||
|
||||
def test_compare_with_datetime
|
||||
assert_equal 1, DateTime.civil(2000) <=> DateTime.civil(1999, 12, 31, 23, 59, 59)
|
||||
assert_equal 0, DateTime.civil(2000) <=> DateTime.civil(2000, 1, 1, 0, 0, 0)
|
||||
assert_equal 1, DateTime.civil(2000) <=> DateTime.civil(1999, 12, 31, 23, 59, 59)
|
||||
assert_equal 0, DateTime.civil(2000) <=> DateTime.civil(2000, 1, 1, 0, 0, 0)
|
||||
assert_equal(-1, DateTime.civil(2000) <=> DateTime.civil(2000, 1, 1, 0, 0, 1))
|
||||
end
|
||||
|
||||
def test_compare_with_time_with_zone
|
||||
assert_equal 1, DateTime.civil(2000) <=> ActiveSupport::TimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal 0, DateTime.civil(2000) <=> ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 0, 0, 0), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal 1, DateTime.civil(2000) <=> ActiveSupport::TimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal 0, DateTime.civil(2000) <=> ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 0, 0, 0), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal(-1, DateTime.civil(2000) <=> ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 0, 0, 1), ActiveSupport::TimeZone["UTC"]))
|
||||
end
|
||||
|
||||
def test_compare_with_string
|
||||
assert_equal 1, DateTime.civil(2000) <=> Time.utc(1999, 12, 31, 23, 59, 59).to_s
|
||||
assert_equal 0, DateTime.civil(2000) <=> Time.utc(2000, 1, 1, 0, 0, 0).to_s
|
||||
assert_equal 1, DateTime.civil(2000) <=> Time.utc(1999, 12, 31, 23, 59, 59).to_s
|
||||
assert_equal 0, DateTime.civil(2000) <=> Time.utc(2000, 1, 1, 0, 0, 0).to_s
|
||||
assert_equal(-1, DateTime.civil(2000) <=> Time.utc(2000, 1, 1, 0, 0, 1).to_s)
|
||||
assert_nil DateTime.civil(2000) <=> "Invalid as Time"
|
||||
end
|
||||
|
||||
def test_compare_with_integer
|
||||
assert_equal 1, DateTime.civil(1970, 1, 1, 12, 0, 0) <=> 2440587
|
||||
assert_equal 0, DateTime.civil(1970, 1, 1, 12, 0, 0) <=> 2440588
|
||||
assert_equal 1, DateTime.civil(1970, 1, 1, 12, 0, 0) <=> 2440587
|
||||
assert_equal 0, DateTime.civil(1970, 1, 1, 12, 0, 0) <=> 2440588
|
||||
assert_equal(-1, DateTime.civil(1970, 1, 1, 12, 0, 0) <=> 2440589)
|
||||
end
|
||||
|
||||
def test_compare_with_float
|
||||
assert_equal 1, DateTime.civil(1970) <=> 2440586.5
|
||||
assert_equal 0, DateTime.civil(1970) <=> 2440587.5
|
||||
assert_equal 1, DateTime.civil(1970) <=> 2440586.5
|
||||
assert_equal 0, DateTime.civil(1970) <=> 2440587.5
|
||||
assert_equal(-1, DateTime.civil(1970) <=> 2440588.5)
|
||||
end
|
||||
|
||||
def test_compare_with_rational
|
||||
assert_equal 1, DateTime.civil(1970) <=> Rational(4881173, 2)
|
||||
assert_equal 0, DateTime.civil(1970) <=> Rational(4881175, 2)
|
||||
assert_equal 1, DateTime.civil(1970) <=> Rational(4881173, 2)
|
||||
assert_equal 0, DateTime.civil(1970) <=> Rational(4881175, 2)
|
||||
assert_equal(-1, DateTime.civil(1970) <=> Rational(4881177, 2))
|
||||
end
|
||||
|
||||
|
|
|
@ -756,26 +756,26 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_compare_with_time
|
||||
assert_equal 1, Time.utc(2000) <=> Time.utc(1999, 12, 31, 23, 59, 59, 999)
|
||||
assert_equal 0, Time.utc(2000) <=> Time.utc(2000, 1, 1, 0, 0, 0)
|
||||
assert_equal 1, Time.utc(2000) <=> Time.utc(1999, 12, 31, 23, 59, 59, 999)
|
||||
assert_equal 0, Time.utc(2000) <=> Time.utc(2000, 1, 1, 0, 0, 0)
|
||||
assert_equal(-1, Time.utc(2000) <=> Time.utc(2000, 1, 1, 0, 0, 0, 001))
|
||||
end
|
||||
|
||||
def test_compare_with_datetime
|
||||
assert_equal 1, Time.utc(2000) <=> DateTime.civil(1999, 12, 31, 23, 59, 59)
|
||||
assert_equal 0, Time.utc(2000) <=> DateTime.civil(2000, 1, 1, 0, 0, 0)
|
||||
assert_equal 1, Time.utc(2000) <=> DateTime.civil(1999, 12, 31, 23, 59, 59)
|
||||
assert_equal 0, Time.utc(2000) <=> DateTime.civil(2000, 1, 1, 0, 0, 0)
|
||||
assert_equal(-1, Time.utc(2000) <=> DateTime.civil(2000, 1, 1, 0, 0, 1))
|
||||
end
|
||||
|
||||
def test_compare_with_time_with_zone
|
||||
assert_equal 1, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal 0, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 0, 0, 0), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal 1, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal 0, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 0, 0, 0), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal(-1, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 0, 0, 1), ActiveSupport::TimeZone["UTC"]))
|
||||
end
|
||||
|
||||
def test_compare_with_string
|
||||
assert_equal 1, Time.utc(2000) <=> Time.utc(1999, 12, 31, 23, 59, 59, 999).to_s
|
||||
assert_equal 0, Time.utc(2000) <=> Time.utc(2000, 1, 1, 0, 0, 0).to_s
|
||||
assert_equal 1, Time.utc(2000) <=> Time.utc(1999, 12, 31, 23, 59, 59, 999).to_s
|
||||
assert_equal 0, Time.utc(2000) <=> Time.utc(2000, 1, 1, 0, 0, 0).to_s
|
||||
assert_equal(-1, Time.utc(2000) <=> Time.utc(2000, 1, 1, 0, 0, 1, 0).to_s)
|
||||
assert_nil Time.utc(2000) <=> "Invalid as Time"
|
||||
end
|
||||
|
@ -863,11 +863,11 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_minus_with_time_with_zone
|
||||
assert_equal 86_400.0, Time.utc(2000, 1, 2) - ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal 86_400.0, Time.utc(2000, 1, 2) - ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1), ActiveSupport::TimeZone["UTC"])
|
||||
end
|
||||
|
||||
def test_minus_with_datetime
|
||||
assert_equal 86_400.0, Time.utc(2000, 1, 2) - DateTime.civil(2000, 1, 1)
|
||||
assert_equal 86_400.0, Time.utc(2000, 1, 2) - DateTime.civil(2000, 1, 1)
|
||||
end
|
||||
|
||||
def test_time_created_with_local_constructor_cannot_represent_times_during_hour_skipped_by_dst
|
||||
|
|
|
@ -221,20 +221,20 @@ class TimeWithZoneTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_compare_with_time
|
||||
assert_equal 1, @twz <=> Time.utc(1999, 12, 31, 23, 59, 59)
|
||||
assert_equal 0, @twz <=> Time.utc(2000, 1, 1, 0, 0, 0)
|
||||
assert_equal 1, @twz <=> Time.utc(1999, 12, 31, 23, 59, 59)
|
||||
assert_equal 0, @twz <=> Time.utc(2000, 1, 1, 0, 0, 0)
|
||||
assert_equal(-1, @twz <=> Time.utc(2000, 1, 1, 0, 0, 1))
|
||||
end
|
||||
|
||||
def test_compare_with_datetime
|
||||
assert_equal 1, @twz <=> DateTime.civil(1999, 12, 31, 23, 59, 59)
|
||||
assert_equal 0, @twz <=> DateTime.civil(2000, 1, 1, 0, 0, 0)
|
||||
assert_equal 1, @twz <=> DateTime.civil(1999, 12, 31, 23, 59, 59)
|
||||
assert_equal 0, @twz <=> DateTime.civil(2000, 1, 1, 0, 0, 0)
|
||||
assert_equal(-1, @twz <=> DateTime.civil(2000, 1, 1, 0, 0, 1))
|
||||
end
|
||||
|
||||
def test_compare_with_time_with_zone
|
||||
assert_equal 1, @twz <=> ActiveSupport::TimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal 0, @twz <=> ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 0, 0, 0), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal 1, @twz <=> ActiveSupport::TimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal 0, @twz <=> ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 0, 0, 0), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal(-1, @twz <=> ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 0, 0, 1), ActiveSupport::TimeZone["UTC"]))
|
||||
end
|
||||
|
||||
|
@ -340,13 +340,13 @@ class TimeWithZoneTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_minus_with_time
|
||||
assert_equal 86_400.0, ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 2), ActiveSupport::TimeZone["UTC"]) - Time.utc(2000, 1, 1)
|
||||
assert_equal 86_400.0, ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 2), ActiveSupport::TimeZone["Hawaii"]) - Time.utc(2000, 1, 1)
|
||||
assert_equal 86_400.0, ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 2), ActiveSupport::TimeZone["UTC"]) - Time.utc(2000, 1, 1)
|
||||
assert_equal 86_400.0, ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 2), ActiveSupport::TimeZone["Hawaii"]) - Time.utc(2000, 1, 1)
|
||||
end
|
||||
|
||||
def test_minus_with_time_precision
|
||||
assert_equal 86_399.999999998, ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 2, 23, 59, 59, Rational(999999999, 1000)), ActiveSupport::TimeZone["UTC"]) - Time.utc(2000, 1, 2, 0, 0, 0, Rational(1, 1000))
|
||||
assert_equal 86_399.999999998, ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 2, 23, 59, 59, Rational(999999999, 1000)), ActiveSupport::TimeZone["Hawaii"]) - Time.utc(2000, 1, 2, 0, 0, 0, Rational(1, 1000))
|
||||
assert_equal 86_399.999999998, ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 2, 23, 59, 59, Rational(999999999, 1000)), ActiveSupport::TimeZone["UTC"]) - Time.utc(2000, 1, 2, 0, 0, 0, Rational(1, 1000))
|
||||
assert_equal 86_399.999999998, ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 2, 23, 59, 59, Rational(999999999, 1000)), ActiveSupport::TimeZone["Hawaii"]) - Time.utc(2000, 1, 2, 0, 0, 0, Rational(1, 1000))
|
||||
end
|
||||
|
||||
def test_minus_with_time_with_zone
|
||||
|
@ -358,20 +358,20 @@ class TimeWithZoneTest < ActiveSupport::TestCase
|
|||
def test_minus_with_time_with_zone_precision
|
||||
twz1 = ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 0, 0, 0, Rational(1, 1000)), ActiveSupport::TimeZone["UTC"])
|
||||
twz2 = ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 23, 59, 59, Rational(999999999, 1000)), ActiveSupport::TimeZone["UTC"])
|
||||
assert_equal 86_399.999999998, twz2 - twz1
|
||||
assert_equal 86_399.999999998, twz2 - twz1
|
||||
end
|
||||
|
||||
def test_minus_with_datetime
|
||||
assert_equal 86_400.0, ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 2), ActiveSupport::TimeZone["UTC"]) - DateTime.civil(2000, 1, 1)
|
||||
assert_equal 86_400.0, ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 2), ActiveSupport::TimeZone["UTC"]) - DateTime.civil(2000, 1, 1)
|
||||
end
|
||||
|
||||
def test_minus_with_datetime_precision
|
||||
assert_equal 86_399.999999999, ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 23, 59, 59, Rational(999999999, 1000)), ActiveSupport::TimeZone["UTC"]) - DateTime.civil(2000, 1, 1)
|
||||
assert_equal 86_399.999999999, ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 23, 59, 59, Rational(999999999, 1000)), ActiveSupport::TimeZone["UTC"]) - DateTime.civil(2000, 1, 1)
|
||||
end
|
||||
|
||||
def test_minus_with_wrapped_datetime
|
||||
assert_equal 86_400.0, ActiveSupport::TimeWithZone.new(DateTime.civil(2000, 1, 2), ActiveSupport::TimeZone["UTC"]) - Time.utc(2000, 1, 1)
|
||||
assert_equal 86_400.0, ActiveSupport::TimeWithZone.new(DateTime.civil(2000, 1, 2), ActiveSupport::TimeZone["UTC"]) - DateTime.civil(2000, 1, 1)
|
||||
assert_equal 86_400.0, ActiveSupport::TimeWithZone.new(DateTime.civil(2000, 1, 2), ActiveSupport::TimeZone["UTC"]) - Time.utc(2000, 1, 1)
|
||||
assert_equal 86_400.0, ActiveSupport::TimeWithZone.new(DateTime.civil(2000, 1, 2), ActiveSupport::TimeZone["UTC"]) - DateTime.civil(2000, 1, 1)
|
||||
end
|
||||
|
||||
def test_plus_and_minus_enforce_spring_dst_rules
|
||||
|
|
|
@ -250,8 +250,8 @@ module Notifications
|
|||
time = Time.now
|
||||
event = event(:foo, time, time + 0.01, random_id, {})
|
||||
|
||||
assert_equal :foo, event.name
|
||||
assert_equal time, event.time
|
||||
assert_equal :foo, event.name
|
||||
assert_equal time, event.time
|
||||
assert_in_delta 10.0, event.duration, 0.00001
|
||||
end
|
||||
|
||||
|
|
|
@ -1419,11 +1419,11 @@ module ApplicationTests
|
|||
test "Rails.application#env_config exists and include some existing parameters" do
|
||||
make_basic_app
|
||||
|
||||
assert_equal app.env_config["action_dispatch.parameter_filter"], app.config.filter_parameters
|
||||
assert_equal app.env_config["action_dispatch.show_exceptions"], app.config.action_dispatch.show_exceptions
|
||||
assert_equal app.env_config["action_dispatch.logger"], Rails.logger
|
||||
assert_equal app.env_config["action_dispatch.backtrace_cleaner"], Rails.backtrace_cleaner
|
||||
assert_equal app.env_config["action_dispatch.key_generator"], Rails.application.key_generator
|
||||
assert_equal app.env_config["action_dispatch.parameter_filter"], app.config.filter_parameters
|
||||
assert_equal app.env_config["action_dispatch.show_exceptions"], app.config.action_dispatch.show_exceptions
|
||||
assert_equal app.env_config["action_dispatch.logger"], Rails.logger
|
||||
assert_equal app.env_config["action_dispatch.backtrace_cleaner"], Rails.backtrace_cleaner
|
||||
assert_equal app.env_config["action_dispatch.key_generator"], Rails.application.key_generator
|
||||
end
|
||||
|
||||
test "config.colorize_logging default is true" do
|
||||
|
|
|
@ -140,7 +140,7 @@ module ApplicationTests
|
|||
etag = last_response.headers["ETag"]
|
||||
|
||||
get "/expires/expires_etag", { private: true }, { "HTTP_IF_NONE_MATCH" => etag }
|
||||
assert_equal "miss", last_response.headers["X-Rack-Cache"]
|
||||
assert_equal "miss", last_response.headers["X-Rack-Cache"]
|
||||
assert_not_equal body, last_response.body
|
||||
end
|
||||
|
||||
|
@ -174,7 +174,7 @@ module ApplicationTests
|
|||
last = last_response.headers["Last-Modified"]
|
||||
|
||||
get "/expires/expires_last_modified", { private: true }, { "HTTP_IF_MODIFIED_SINCE" => last }
|
||||
assert_equal "miss", last_response.headers["X-Rack-Cache"]
|
||||
assert_equal "miss", last_response.headers["X-Rack-Cache"]
|
||||
assert_not_equal body, last_response.body
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue