blob: 52c92ee32696ecc43735e0cea1950e921f105e12 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
Given /^I authenticated$/ do
@testcode = InviteCode.new
@testcode.save!
@user = FactoryGirl.create(:user, :invite_code => @testcode.invite_code)
@my_auth_token = Token.create user_id: @user.id
end
Given /^I am not logged in$/ do
@my_auth_token = nil
end
When /^I send requests to these endpoints:$/ do |endpoints|
@endpoints = endpoints.rows_hash
end
Then /^they should require authentication$/ do
@endpoints.each do |type, path|
opts = {method: type.downcase.to_sym}
request path, opts
assert_equal 401, last_response.status,
"Expected #{type} #{path} to require authentication."
end
end
|