undefined method 'view_paths' for #<Array:0x34568f4>?Realy?

I write a functional test,here is the code:
require File.dirname(__FILE__) + '/../test_helper'
require 'welcome_controller'

# Re-raise errors caught by the controller.
class WelcomeController; def rescue_action(e) raise e end; end

class WelcomeControllerTest < Test::Unit::TestCase

  fixtures :coursetemplates
  fixtures :coursecatalogs
  fixtures :currencies
  fixtures :states
  fixtures :butypes
  fixtures :pageformats

  def setup
    @controller = WelcomeController.new
    @request = ActionController::TestRequest.new
    @response = ActionController::TestResponse.new
  end

  def test_register
    # if register,the controller must create a default bu,
    # a default user belong to the bu,ten materialuserdefines,ten
batchmaterialuserdefines,
    # a coursecodeexample,a vouchertype and courses accroding to the
coursetemples
    post :create, :account => { :name_native => "test account",
                                :name_eng => "test account",
                                :email => "testemail@test.com",
                                :phone => "testphone",
                                :currency_id => 1}
    #p @response
    assert_response :success
  end

  def test_login
    assert true
  end
end

and the function is below:
def create
    begin
      @account=Account.new(params[:account])

      @bu=Bu.new(:code=>"000",:name_native=>"Manager
Center",:name_eng=>"Manager Center",:isdefault=>true,:butype_id=>"1")
      @user=User.new(:code=>"admin",:password=>"groupart",:isdefault=>true)
      @usereditor=Usereditor.new
      @usereditor.createdman=@user
      @usereditor.updatedman=@user
      @user.usereditor=@usereditor

      @bu.users<<@user
      @bu.createdman=@user
      @bu.updatedman=@user

      @account.bus<<@bu
      @account.users<<@user

      i=1
      10.times {
        @materialuserdefine=Materialuserdefine.new(:columnname=>"user_define"
+ i.to_s,:definename=>"user_define" + i.to_s,:datatype_id=>1)
        @materialuserdefine.createdman=@user
        @materialuserdefine.updatedman=@user
        @batchuserdefine=Batchuserdefine.new(:columnname=>"user_define"
+ i.to_s,:definename=>"user_define" + i.to_s,:datatype_id=>1)
        @batchuserdefine.createdman=@user
        @batchuserdefine.updatedman=@user
        i=i+1
        @account.materialuserdefines<<@materialuserdefine
        @account.batchuserdefines<<@batchuserdefine
      }

      @template =
Coursetemplate.find(:all,:conditions=>["coursegrade=1"])
      @account.courses << getcoursearray(@template,@user,@account)

      @coursecodeformat=Coursecodeformat.new()
      @coursecodeformat.createdman=@user
      @coursecodeformat.updatedman=@user
      @account.coursecodeformat = @coursecodeformat

      @vouchertype=Vouchertype.new(:name_native => 'voucher',:isdefault
=> true )
      @vouchertype.createdman=@user
      @vouchertype.updatedman=@user
      @account.vouchertypes << @vouchertype

      @account.save!

      render :json => {:success => true}.to_json,:layout=>false
    rescue Exception => exc
      render :json => {:success =>
false,:errors=>exc.message}.to_json,:layout=>false
    end
  end

when I run the test,system always told me like below:
1) Errors:
test_register(WelcomeControllerTest):
NoMethodError: undefined method 'view_paths' for #<Array:0x34568f4>

I also upload the error picture

I don't know why,who can help me.

By the way,I use the extjs, so when I submit a form,I always use the
instrustion like below:
render :json => {:success => true}.to_json,:layout=>false

Attachments:
http://www.ruby-forum.com/attachment/2274/error.JPG

when I run the test,system always told me like below:
1) Errors:
test_register(WelcomeControllerTest):
NoMethodError: undefined method 'view_paths' for #<Array:0x34568f4>

I also upload the error picture

I don't know why,who can help me.

Because you have an instance variable called @template (which rails
assumes is something else)

Fred

Frederick Cheung wrote:

when I run the test,system always told me like below:
1) Errors:
test_register(WelcomeControllerTest):
NoMethodError: undefined method 'view_paths' for #<Array:0x34568f4>

I also upload the error picture

I don't know why,who can help me.

Because you have an instance variable called @template (which rails
assumes is something else)

Fred

Thanks, I know,thank you vary mach