require "test_helper"
class UserTermsSeenTest < ActionDispatch::IntegrationTest
- fixtures :users
-
- setup do
- stub_request(:get, "http://api.hostip.info/country.php?ip=127.0.0.1")
+ def setup
+ stub_hostip_requests
end
def test_api_blocked
with_terms_seen(true) do
- user = users(:terms_not_seen_user)
+ user = create(:user, :terms_seen => false)
get "/api/#{API_VERSION}/user/preferences", nil, auth_header(user.display_name, "test")
assert_response :forbidden
def test_terms_presented_at_login
with_terms_seen(true) do
- user = users(:terms_not_seen_user)
+ user = create(:user, :terms_seen => false)
# try to log in
get_via_redirect "/login"
def test_terms_cant_be_circumvented
with_terms_seen(true) do
- user = users(:terms_not_seen_user)
+ user = create(:user, :terms_seen => false)
# try to log in
get_via_redirect "/login"