class FixturesWithoutInstantiationTest

Public Instance Methods

test_accessor_methods() click to toggle source
# File activerecord/test/cases/fixtures_test.rb, line 465
def test_accessor_methods
  assert_equal "The First Topic", topics(:first).title
  assert_equal "Jamis", developers(:jamis).name
  assert_equal 50, accounts(:signals37).credit_limit
end
test_accessor_methods_with_multiple_args() click to toggle source
# File activerecord/test/cases/fixtures_test.rb, line 471
def test_accessor_methods_with_multiple_args
  assert_equal 2, topics(:first, :second).size
  assert_raise(StandardError) { topics([:first, :second]) }
end
test_fixtures_from_root_yml_without_instantiation() click to toggle source
# File activerecord/test/cases/fixtures_test.rb, line 456
def test_fixtures_from_root_yml_without_instantiation
  assert !defined?(@unknown), "@unknown is not defined"
end
test_reloading_fixtures_through_accessor_methods() click to toggle source
# File activerecord/test/cases/fixtures_test.rb, line 476
def test_reloading_fixtures_through_accessor_methods
  topic = Struct.new(:title)
  assert_equal "The First Topic", topics(:first).title
  assert_called(@loaded_fixtures["topics"]["first"], :find, returns: topic.new("Fresh Topic!")) do
    assert_equal "Fresh Topic!", topics(:first, true).title
  end
end
test_visibility_of_accessor_method() click to toggle source
# File activerecord/test/cases/fixtures_test.rb, line 460
def test_visibility_of_accessor_method
  assert_equal false, respond_to?(:topics, false), "should be private method"
  assert_equal true, respond_to?(:topics, true), "confirm to respond surely"
end
test_without_complete_instantiation() click to toggle source
# File activerecord/test/cases/fixtures_test.rb, line 449
def test_without_complete_instantiation
  assert !defined?(@first)
  assert !defined?(@topics)
  assert !defined?(@developers)
  assert !defined?(@accounts)
end