Attribute not accessible via Rspec <p>Models:</p> <pre><code>class User &lt; ActiveRecord:Base has_many :roles has_many :networks, :through =&gt; :roles end class Network &lt; ActiveRecord:Base has_many :roles has_many :network, :through =&gt; :roles end class Role &lt; ActiveRecord:Base attr_accesible :user_id, :network_id, :position belongs_to :user belongs_to :network end </code></pre> <p>The default for role is "member"</p> <p>In the console I can type:</p> <pre><code>&gt; @role = Role.find(1) &gt; @role.position =&gt; "member" </code></pre> <p>But in my Rspec tests, I use FactoryGirl to create a user, network, and role. And I have the test <code>@role.should respond_to(:position)</code> I have also tried just assigning it <code>@role.position = "admin"</code>. And no matter what, I get an error like:</p> <pre><code>Failure/Error: @role.should respond_to(:position) expected [#&lt;Role id:1, user_id: 1, position: "member", created_at...updated_at...&gt;] to respond to :position </code></pre> <p>Am I missing something very basic?</p> <p>EDIT:</p> <p>factories.rb</p> <pre><code>FactoryGirl.define do factory :user do name "Example User" sequence(:email) {|n| "email#{n}@program.com"} end factory :network do sequence(:name) {|n| "Example Network #{n}"} location "Anywhere, USA" description "Lorem Ipsum" end factory :role do association :user association :network position "member" end end </code></pre> <p>network_controller_spec</p> <pre><code>... before(:each) do @user = test_sign_in(FactoryGirl.create(:user) @network = FactoryGirl.create(:network) @role = FactoryGirl.create(:role, :user_id =&gt; @user.id, :network_id = @network.id) #I have also tried without using (_id) I have tried not setting the position in the factories as well. end it "should respond to position" do get :show, :id =&gt; @network # This may not be the best or even correct way to find this. But there should only be one, and this method works in the console. @role = Role.where(:user_id =&gt; @user.id, :network_id =&gt; @network.id) @role.should respond_to(:position) end </code></pre>