# Instance variable attributes() method in tests fixtures

**URL:** <https://www.ruby-forum.com/t/instance-variable-attributes-method-in-tests-fixtures/104793>\
**Category:** Rails\
**Created:** [May 22, 2007, 5:11pm UTC](https://www.ruby-forum.com/t/instance-variable-attributes-method-in-tests-fixtures/104793 "2007-05-22T17:11:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [May 22, 2007, 5:11pm UTC](https://www.ruby-forum.com/t/instance-variable-attributes-method-in-tests-fixtures/104793/1 "2007-05-22T17:11:15Z")

</div>

as stated in Rails Book example , I have a fixtures file orders.yml

valid\_order\_for\_fred:  
id: 1  
name: Fred  
email\_address: fred@flinstone;com

in my controller test file, I tried :  
fixtures :orders  
def test\_save\_valid\_order  
post :save\_order, :order =\> @valid\_order\_fo\_fred.attributes

but I get an error

NoMethodError: You have a nil object when you didn’t expect it!  
You might have expected an instance of ActiveRecord::Base.  
The error occurred while evaluating nil.attributes  
test/functional/orders\_controller\_test.rb:65:in  
`test\_save\_valid\_order’
