blob: 50c528bc7522e06a6ff078ef7b9be2989c8e437e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
class ApiIntegrationTest < ActionDispatch::IntegrationTest
DUMMY_TOKEN = Token.new
RACK_ENV = {'HTTP_AUTHORIZATION' => %Q(Token token="#{DUMMY_TOKEN.to_s}")}
def login(user = nil)
@user ||= user ||= FactoryGirl.create(:user)
@token ||= DUMMY_TOKEN
@token.user_id = @user.id
@token.last_seen_at = Time.now
@token.save
end
teardown do
if @user && @user.persisted?
Identity.destroy_all_for @user
@user.reload.destroy
end
if @token && @token.persisted?
@token.reload.destroy
end
end
end
|