以下は、コントローラーからの私の検索方法です
@accounts = []
client = GameAccounts::GameAccountsClient.new
if params[:name]
# Try and find a game account by id using the given name
response = client.get_accounts_by_name(params[:name])
if response.is_a?(Net::HTTPSuccess)
account = client.parse_json(response)
unless account.empty?
session[:account] = account
redirect_to game_account_path(params[:name])
end
end
json = client.get_json(params[:limit],params[:offset],params[:name])
@presenter = GameAccountsPresenter.new(json)
end
end
次のテストを実行しようとしています:
require 'spec_helper'
describe GameAccountsController do
describe 'GET search' do
it 'finds a named system account directly' do
get(:search, name: 'test').to be_redirect_to(game_account_path('test'))
end
end
end
私は取得し続けます
GameAccountsController GET search finds a named system account directly
Failure/Error: get(:search, name: 'test').to be_redirect_to(game_account_path('test'))
NoMethodError:
undefined method `to' for #<ActionController::TestResponse:0x007f8b0beb3e10>
# ./spec/controllers/game_accounts_controller_spec.rb:6:in `block (3 levels) in <top (required)>'
誰か私が間違っていることを教えてください?? .. .should redirect_to を実行しようとしましたが、同じエラーが発生しますが、メソッドは 'should' です。