# Type error in unit test

**URL:** <https://www.ruby-forum.com/t/type-error-in-unit-test/125523>\
**Category:** Rails\
**Created:** [January 9, 2008, 10:28pm UTC](https://www.ruby-forum.com/t/type-error-in-unit-test/125523 "2008-01-09T22:28:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 9, 2008, 10:28pm UTC](https://www.ruby-forum.com/t/type-error-in-unit-test/125523/1 "2008-01-09T22:28:53Z")

</div>

Hi,

I ve got a really strange issue with one of my test unit files…

When I run that test unit I get a Type Error:  
test\_planned\_records\_with\_done\_records(RindTod):  
TypeError: {:rind=\>#\<Rind:0x4bdcfc8 @unsaved=false,  
@rind\_daten=[#\<RindBrunst:0x  
4f80300 @first\_planungsdatum\_change=false,  
@attributes={“test\_ergebnis\_id”=\>“2”,  
“updated\_at”=\>“2008-01-09 22:22:28”, “planungsdatum”=\>“2009-05-19”,  
“gewicht”=\>  
nil, “todes\_art\_id”=\>nil, “rind\_mehrling\_anzahl\_id”=\>nil,  
“planungsregel\_id”=\>"3  
", “rind\_id”=\>“6”, “hinten\_links”=\>“1”, “vorne\_links”=\>“1”,  
“start\_laktzyklus”=\>  
nil, “land\_id”=\>nil, “lock\_version”=\>“0”, “bemerkung”=\>nil,  
“kurzinfo”=\>“Ergebni  
s: Unbekannt”, “datum”=\>nil, “type”=\>"Rind  
./test/unit/rind\_tod\_test.rb:53:in `new' ./test/unit/rind_tod_test.rb:53:in`test\_planned\_records\_with\_done\_records’

I ve got absolutely no idea why that error is happening.

Maybe anybody has an idea what might be the reason?

Thanks a lot.

–  
Volker

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 10, 2008, 12:22am UTC](https://www.ruby-forum.com/t/type-error-in-unit-test/125523/2 "2008-01-10T00:22:01Z")

</div>

Can you show us the code around line 53 in this file please:  
./test/unit/rind\_tod\_test.rb

On Jan 10, 2008 7:58 AM, removed\_email\_address@domain.invalid  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> @attributes={“test\_ergebnis\_id”=\>“2”,  
> ./test/unit/rind\_tod\_test.rb:53:in
> 
> >

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

Feel free to add me to MSN and/or GTalk as this email.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 21, 2008, 7:35pm UTC](https://www.ruby-forum.com/t/type-error-in-unit-test/125523/3 "2008-01-21T19:35:30Z")

</div>

Sorry, it took so long to answer…

@my\_cattle = Cattle.find\_by\_name(“lisa”)  
my\_tod = CattleDeath.new(:planungsdatum =\> Date.today + 20,  
:datum =\> Date.today + 20,  
:todes\_art =\>  
TodesArt.find\_by\_hit\_code\_nr(1),  
:rind =\> @my\_rind)  
my\_tod.save!

Error is happening in CattleDeath.new()
