title: Using factory_girl_rails with Rspec on namespaced models
body: <p>I have a web service that serves Ads to several different clients. The structure of the Ad varies between clients, and therefore, I am using namespaces for my models and controllers by the client name to differentiate between Ads. From the high level, it looks like this:  </p>
  
  <p><code>'app/models/client1/ad.rb'</code></p>
  
  <pre><code>class Client1::Ad &lt; ActiveRecord::Base
    attr_accessible :title, :description
  end
  </code></pre>
  
  <p><code>'app/models/client2/ad.rb'</code></p>
  
  <pre><code>class Client2::Ad &lt; ActiveRecord::Base
    attr_accessible :title, :description, :source
  end
  </code></pre>
  
  <p>In reality, these models are more complex and have associations, but that is not the point.<br>
  I am writing some unit tests using rspec-rails 2.4.0 and factory_girl_rails 1.0.1, and all of my factories work great. However, I am not able to define factories for the namespaced models. I've tried something like:  </p>
  
  <pre><code>Factory.define :client1_ad, :class =&gt; Client1::Ad do |ad|
    ad.title       "software tester"  
    ad.description "Immediate opening"
  end  
  </code></pre>
  
  <p>and</p>
  
  <pre><code>Factory.define :client2_ad, :class =&gt; Client2::Ad do |ad|
    ad.title       "software tester"  
    ad.description "Immediate opening"
    ad.source      "feed"
  end
  </code></pre>
  
  <p>It didn't do the job. I looked around, but every single example that I saw was using non-namespaced models. Anyone have any ideas? Any input is greatly appreciated.</p>