blob: 81c5fc549341bc76bda7e54140e4a7cd4cb82f40 (
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 = FactoryBot.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
|