Sha256: 1d90bfee17acee279edc42218be79bfb65b45e13ee4391afd39798ac9beabe97

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

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

class MissingFixtureMigration < ActiveRecord::Migration
  def self.up
	create_table :missing_fixture_parents do |t|
		t.column :field, :string
		t.column :missing_fixture_child_id, :integer
	end	
	create_table :missing_fixture_children do |t|
		t.column :field, :string
	end	
  end

  def self.down
	drop_table :missing_fixture_parents
	drop_table :missing_fixture_children
  end
end

class MissingFixtureParent < ActiveRecord::Base
	belongs_to :missing_fixture_child
end

class MissingFixtureChild < ActiveRecord::Base
end

class MissingFixtureTest < Test::Unit::TestCase
	fixtures :missing_fixture_parents
	
	def test_error_if_not_all_fixtures_recieving_entries_are_specified
		error_test(MissingFixtureError) do
		setup_fixtures(
:missing_fixture_parents => %Q{
parent_entry:
  field: parent_entry
  missing_fixture_child:
    child_entry:
      field: child value})
		end
	end
	
	def test_no_error_if_missing_fixture_is_not_required
		setup_fixtures(
:missing_fixture_parents => %Q{
parent_entry:
  field: parent value})
		
		assert_fixtures(
:missing_fixture_parents  => %Q{
parent_entry:
  id: 1
  field: parent value})
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
joinfix-0.1.1 test/missing_fixture_test.rb
joinfix-1.0.0 test/missing_fixture_test.rb
joinfix-1.0.1 test/missing_fixture_test.rb