Sha256: a039c951e1febad4f466e04b1b954cb4c48f03254b019d070af7b67a7fcd3d61

Contents?: true

Size: 901 Bytes

Versions: 4

Compression:

Stored size: 901 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class NestedParentTest < Test::Unit::TestCase
	fixtures :nested_parents, :nested_children, :inner_children
	
	def test_nested_fixtures
		parent_one= nested_parents(:parent_one)
		parent_two = nested_parents(:parent_two)
		parent_three = nested_parents(:parent_three)
		parent_four = nested_parents(:parent_four)
			
		query_result = NestedChild.find_by_field(1).nested_parent
		assert_equal parent_one, query_result
			
		query_result = NestedParent.find_by_field(1).nested_children.first.inner_children.first.nested_parents
		assert_equal [parent_two, parent_three], query_result
			
		query_result = NestedParent.find_by_field(1).inner_child.nested_child.nested_parent
		assert_equal parent_two, query_result
			
		query_result = InnerChild.find_by_field(3).nested_parents.first
		assert_equal parent_four, query_result
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
joinfix-0.1.0 rails/test/unit/nested_parent_test.rb
joinfix-0.1.1 rails/test/unit/nested_parent_test.rb
joinfix-1.0.0 rails/test/unit/nested_parent_test.rb
joinfix-1.0.1 rails/test/unit/nested_parent_test.rb