Improve tests

#694
This commit is contained in:
Artur Beljajev 2018-02-19 02:40:25 +02:00
parent 07e40d61dd
commit 34f1e2be2f
2 changed files with 13 additions and 0 deletions

View file

@ -3,6 +3,7 @@ require 'test_helper'
class APIDomainTransfersTest < ActionDispatch::IntegrationTest
def setup
@domain = domains(:shop)
Setting.transfer_wait_time = 0 # Auto-approval
end
def test_returns_domain_transfers
@ -14,6 +15,12 @@ class APIDomainTransfersTest < ActionDispatch::IntegrationTest
JSON.parse(response.body, symbolize_names: true)
end
def test_creates_new_domain_transfer
assert_difference -> { @domain.domain_transfers.size } do
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
end
end
def test_approves_automatically_if_auto_approval_is_enabled
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
assert @domain.domain_transfers(true).last.approved?