Sha256: 49199dc674f9604945b8ae7440948be6bfd58024bb44d634143bf631368ddaca
Contents?: true
Size: 985 Bytes
Versions: 3
Compression:
Stored size: 985 Bytes
Contents
require File.expand_path('../abstract_unit', __FILE__) class TestExists < ActiveSupport::TestCase fixtures :articles, :departments def test_id assert(Article.exists?(1)) assert(!Article.exists?(-1)) end def test_array assert(Article.exists?(['name = ?', 'Article One'])) assert(!Article.exists?(['name = ?', 'Article -1'])) end def test_hash assert(Article.exists?('name' => 'Article One')) assert(!Article.exists?('name' => 'Article -1')) end def test_cpk_id assert(Department.exists?(CompositePrimaryKeys::CompositeKeys.new([1,1]))) assert(!Department.exists?(CompositePrimaryKeys::CompositeKeys.new([1,-1]))) end def test_cpk_array_id assert(Department.exists?([1,1])) assert(!Department.exists?([1,-1])) end def test_cpk_array_condition assert(Department.exists?(['department_id = ? and location_id = ?', 1, 1])) assert(!Department.exists?(['department_id = ? and location_id = ?', 1, -1])) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
composite_primary_keys-5.0.0.rc1 | test/test_exists.rb |
composite_primary_keys-4.1.2 | test/test_exists.rb |
composite_primary_keys-4.1.1 | test/test_exists.rb |