This project is archived and is in readonly mode.

#307 ✓invalid
James M. McLachlan

FixtureClassNotFound when using Namespaces in Unit Test

Reported by James M. McLachlan | June 2nd, 2008 @ 11:29 PM

If have namespaced model classes, Party::Base and Party::Address, with their corresponding Unit test in the test/party directory the unit for the first starts failing once the second is added with a "FixtureClassNotFound: No class attached to find" error even if set_fixture_class is explicitly denoted.

When I remove the second unit test from the directory, everything runs fine once again.

My model classes are as follows:

class Party::Base < ActiveRecord::Base

set_table_name :parties

has_many :addresses,

:foreign_key => 'party_id'


class Party::Address < ActiveRecord::Base

belongs_to :party,

:class_name => "Party::Base",

:foreign_key => 'party_id'


A simple unit test for Party::Base works fine if no other test is present.

require 'test_helper'

class Party::BaseTest < ActiveSupport::TestCase

fixtures :parties

set_fixture_class :parties => Party::Base

  1. Replace this with your real tests.

def test_james_in_fixture

assert(parties(:one).name == "James McLachlan")



once I add Party::AddressTest if gives me the error:


FixtureClassNotFound: No class attached to find.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket


Referenced by