Forum: Ruby on Rails Problem with functional 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.
C5283f5f6e2659a1b4e7ddb87eca0640?d=identicon&s=25 Pietia (Guest)
on 2009-03-25 17:38
(Received via mailing list)
Hi

I have upgraded to 2.3.2 and changed updated everything inside
myproject :


This is my functional TEST :

require 'test_helper'

class Admin::ProjectsControllerTest < ActiveSupport::TestCase

  def test_get_index
    get :index
    assert_response :success
    assert_not_nil assigns(:projects)
  end

end


This is my console :

s128:test pietia$ ruby functional/admin/projects_controller_test.rb
Loaded suite functional/admin/projects_controller_test
Started
E
Finished in 0.119872 seconds.

  1) Error:
test_get_index(Admin::ProjectsControllerTest):
NoMethodError: undefined method `get' for
#<Admin::ProjectsControllerTest:0x25f0df0>
    functional/admin/projects_controller_test.rb:6:in `test_get_index'

1 tests, 0 assertions, 0 failures, 1 errors


Project_controller have index method and it works in browser.

I dont have idea how to solve it, google also don't give me any
answers.
Aad37b5f7116c8d1f547d23b37566032?d=identicon&s=25 Greg Donald (destiney)
on 2009-03-25 19:11
(Received via mailing list)
On Wed, Mar 25, 2009 at 11:37 AM, Pietia <peter.kaleta@gmail.com> wrote:
> I have upgraded to 2.3.2 and changed updated everything inside
> myproject :
>
> This is my functional TEST :
>
> require 'test_helper'
>
> class Admin::ProjectsControllerTest < ActiveSupport::TestCase

You need "fixtures :projects" here.

>  def test_get_index
>    get :index
>    assert_response :success
>    assert_not_nil assigns(:projects)
>  end
>
> end


--
Greg Donald
http://destiney.com/
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-03-25 19:32
(Received via mailing list)
On 25 Mar 2009, at 16:37, Pietia wrote:

>
> class Admin::ProjectsControllerTest < ActiveSupport::TestCase

You should have changed that to ActionController::TestCase.

Fred
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2009-03-25 19:41
(Received via mailing list)
Pietia wrote:

> class Admin::ProjectsControllerTest < ActiveSupport::TestCase

Shouldn't that be like ActiveController::TestCase

?
C5283f5f6e2659a1b4e7ddb87eca0640?d=identicon&s=25 Pietia (Guest)
on 2009-03-25 22:21
(Received via mailing list)
Ty fred, your solution worked , i just didnt notice that it should
derive from action controller ( i copied heading from unit test )
This topic is locked and can not be replied to.