Sha256: cd6533aaa8dc178146af760c534167b6ddd533a1ae435d541c9627f0ee0d6188

Contents?: true

Size: 369 Bytes

Versions: 15

Compression:

Stored size: 369 Bytes

Contents

require 'test_helper'

class Superstore::Associations::HasOneTest < Superstore::TestCase
  class TestObject < Issue
    has_one :favorite_label, class_name: 'Label', foreign_key: 'issue_id'
  end

  test 'has_many' do
    issue = TestObject.create!
    label = Label.create! name: 'important', issue_id: issue.id

    assert_equal label, issue.favorite_label
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
superstore-3.0.0 test/unit/associations/has_one_test.rb
superstore-2.5.0 test/unit/associations/has_one_test.rb
superstore-2.4.4 test/unit/associations/has_one_test.rb
superstore-2.4.3 test/unit/associations/has_one_test.rb
superstore-2.4.2 test/unit/associations/has_one_test.rb
superstore-2.4.1 test/unit/associations/has_one_test.rb
superstore-2.4.0 test/unit/associations/has_one_test.rb
superstore-2.3.0 test/unit/associations/has_one_test.rb
superstore-2.2.0 test/unit/associations/has_one_test.rb
superstore-2.1.3 test/unit/associations/has_one_test.rb
superstore-2.1.2 test/unit/associations/has_one_test.rb
superstore-2.1.1 test/unit/associations/has_one_test.rb
superstore-2.1.0 test/unit/associations/has_one_test.rb
superstore-2.0.1 test/unit/associations/has_one_test.rb
superstore-2.0.0 test/unit/associations/has_one_test.rb