# Weird error when running my unit tests

**URL:** <https://www.ruby-forum.com/t/weird-error-when-running-my-unit-tests/59182>\
**Category:** Rails\
**Created:** [April 30, 2006, 6:40pm UTC](https://www.ruby-forum.com/t/weird-error-when-running-my-unit-tests/59182 "2006-04-30T18:40:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a183cd/32.png) [@alain](https://www.ruby-forum.com/u/alain)\
**Post date:** [April 30, 2006, 6:40pm UTC](https://www.ruby-forum.com/t/weird-error-when-running-my-unit-tests/59182/1 "2006-04-30T18:40:13Z")

</div>

How can this be possible:

I have two tests:

def find\_all\_active\_and\_inactive  
assert\_equal Concept.find\_all\_active\_and\_inactive.size,  
@concepts.size  
end

and

def test\_find\_all\_inactive  
assert\_equal Concept.find\_all\_inactive.size, (@concepts.size -  
Concept.find\_all.size)  
end

Concept.find\_all returns 2 concepts (I overwrote the method to return  
only the active concepts)  
Concept.find\_all\_inactive returns 1 concept  
Concept.find\_all\_active\_and\_inactive returns 3 concepts

And @concepts.size returns 3

When I run the first test, there is no error.

When I run the second test, I get this error:

1. Error:  
test\_find\_all\_inactive(ConceptTest):  
NoMethodError: You have a nil object when you didn’t expect it!  
You might have expected an instance of Array.  
The error occured while evaluating nil.size  
concept\_test.rb:36:in `test\_find\_all\_inactive’

I dont understand! Why is @concepts.size working in the first test and  
not in the second?
