Sha256: 5581fc6fbeb392d3d394bce9823357dfc11ef672d314b2416910e4fe642afa65
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
require File.dirname(__FILE__) + '/joinfix_test_helper' # # hm with options # class HasManyWithOptionsMigration < ActiveRecord::Migration def self.up create_table :hm_with_options_parents do |t| t.column :field, :string end create_table :hm_with_options_children do |t| t.column :field, :string t.column :alternate, :integer end end def self.down drop_table :hm_with_options_parents drop_table :hm_with_options_children end end class HmWithOptionsParent < ActiveRecord::Base has_many :children, :foreign_key => "alternate", :class_name => "HmWithOptionsChild" end class HmWithOptionsChild < ActiveRecord::Base end class HasManyWithOptionsTest < Test::Unit::TestCase fixtures :hm_with_options_parents, :hm_with_options_children def test_has_many_with_options setup_fixtures( :hm_with_options_parents => %Q{ parent_entry: field: parent value children: - child_one: field: one - child_two: field: two}, :hm_with_options_children => "") assert_fixtures( :hm_with_options_parents => %Q{ parent_entry: id: 1 field: parent value}, :hm_with_options_children => %Q{ child_one: id: 1 alternate: 1 field: one child_two: id: 2 alternate: 1 field: two}) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
joinfix-1.0.0 | test/has_many_with_options_test.rb |
joinfix-0.1.1 | test/has_many_with_options_test.rb |
joinfix-1.0.1 | test/has_many_with_options_test.rb |