Forum: Ruby on Rails problems developing a test

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8d4c3605bb2853f5088f8719d352f3cd?d=identicon&s=25 Clem Rock (clemrock)
on 2006-12-24 21:06
Hello,

    I'm pretty new to ruby and I'm trying to develop a test for a simple
method.

The method is this:

def show_details
      @accounts = Account.find( params[:id] )
end

and the test method I'm trying is this:


def test_show_details
    get :index, :context => 'admin', :id => 1
    assert_response :success
    assert_equal assigns(:accounts), accounts(:blake_acount)
end


we have some test data in .yml file called accounts.yml which is stored
in /test/fixtures/ directory and it contains this section on
blake_account:

blake_account:
  id: 1
  user_id: 1
  first_name: Blake
  expire_on: <%= Date.today + 32 %>
  recurring: false
  country_code: US

Don't understand why this fails?
This topic is locked and can not be replied to.