Hi everybody
I have some basic problems with my functional tests. In my controller, I
have the method “index” and “list”.
def index
list
render :action => ‘list’
end
def list
@person_pages, @persons = paginate :persons, :per_page => 200
end
Now I would like to test the controller. So I wrote the test-method like
the following:
def setup
@controller = CurrencyController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
def test_index
get :index
assert_response :success
assert_template ‘list’
end
But it doesn’t work! Why? I receive only these error message:
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.-
We’ll need more information, as what you’ve posted looks fine. What line
is
the NoMethodError thrown from?
Jason
Jason R. wrote:
We’ll need more information, as what you’ve posted looks fine. What line
is
the NoMethodError thrown from?
Jason
/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/transactions.rb:112:in
`unlock_mutex’
/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/fixtures.rb:534:in
`teardown’
Jason R. wrote:
Are you properly pulling in fixtures into your tests (fixtures
:persons)?
Is your data schema in working order (migrations, fixture YAML files,
etc)?
Jason
Yes, I pulling fixtures into my tests. About my data schema. I clone
with rake the whole structure to the test environment.
Are you properly pulling in fixtures into your tests (fixtures
:persons)?
Is your data schema in working order (migrations, fixture YAML files,
etc)?
Jason