Sha256: e49ccff2ee668febd2a59c13776bdc02e804296206ec75d60060d6eaafeb3da9
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
require File.dirname(__FILE__) + '/joinfix_test_helper' # # has many test # class HasManyMigration < ActiveRecord::Migration def self.up create_table :hm_parents do |t| t.column :field, :string end create_table :hm_children do |t| t.column :field, :string t.column :hm_parent_id, :integer end end def self.down drop_table :hm_parents drop_table :hm_children end end class HmParent < ActiveRecord::Base has_many :hm_children end class HmChild < ActiveRecord::Base end class HasManyTest < Test::Unit::TestCase fixtures :hm_parents, :hm_children def test_has_many setup_fixtures( :hm_parents => %Q{ parent_entry: field: parent value hm_children: - child_one: field: one - child_two: field: two}, :hm_children => "") assert_fixtures( :hm_parents => %Q{ parent_entry: id: 1 field: parent value}, :hm_children => %Q{ child_one: id: 1 hm_parent_id: 1 field: one child_two: id: 2 hm_parent_id: 1 field: two}) end def test_error_for_bad_yaml error_test(NoEntryNameError) do setup_fixtures( :hm_parents => %Q{ parent_entry: id: 1 field: parent value hm_children: - child_one: field: one - child_two: field: two}, :hm_children => %Q{}) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
joinfix-1.0.0 | test/has_many_test.rb |
joinfix-1.0.1 | test/has_many_test.rb |