Rails3でrack/testとrspecを使用して、deviseを介してユーザーのAPIキーを認証しています。私が行うリクエストはすべて、ステータス302と「リダイレクトされています」という応答を返します。認証方法がわからないようです。
require 'spec_helper'
describe Api::V1::CollectController do
def app
Rails.application
end
context 'user' do
subject do
FactoryGirl.create :user
end
it 'allow valid api credentials' do
post '/api/collect', {}, { 'Authentication' => subject.authentication_token }
p last_response.body
end
end
end