1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
require "test_helper"
class ApplicationTest < Minitest::Test
include Rack::Test::Methods
def test_request_phrase_not_accessible_via_get
get "/auth/developer"
assert last_response.not_found?
end
def test_request_phrase_without_token_via_post
post "/auth/developer"
follow_redirect!
assert last_response.not_found?
end
def test_request_phrase_with_bad_token_via_post
post "/auth/developer", authenticity_token: "BAD_TOKEN"
follow_redirect!
assert last_response.not_found?
end
def test_request_phrase_with_correct_token_via_post
post "/auth/developer", authenticity_token: authenticity_token
assert last_response.ok?
end
private
def app
Rails.application
end
def authenticity_token
get "/token"
last_response.body
end
end
|