blob: e75455a065a90dce5d7878943b6e283f278dc2dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
Given /^I authenticated$/ do
@user = FactoryGirl.create(:user)
@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
|