added tests

This commit is contained in:
olegphenomenon 2022-07-25 13:17:47 +03:00
parent 35408343e3
commit 55657bd8ef
2 changed files with 44 additions and 1 deletions

View file

@ -28,7 +28,7 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
assert_equal ({ 'id' => '1b3ee442-e8fe-4922-9492-8fcb9dccc69c',
'domain' => 'auction.test',
'status' => Auction.statuses[:awaiting_payment],
'platform' => nil }), ActiveSupport::JSON.decode(response.body)
'platform' => "auto" }), ActiveSupport::JSON.decode(response.body)
end
def test_marks_as_awaiting_payment

View file

@ -131,6 +131,49 @@ class AuctionTest < ActiveSupport::TestCase
assert_not @auction.domain_registrable?('')
end
def test_restart_new_auction_should_with_previous_manual_platform
@auction.update(platform: 'manual')
@auction.reload
assert_equal @auction.platform, 'manual'
assert_difference 'Auction.count' do
@auction.restart
end
new_auction = Auction.last
assert_equal new_auction.platform, 'manual'
end
def test_restart_new_auction_should_with_previous_auto_platform
@auction.update(platform: 'auto')
@auction.reload
assert_equal @auction.platform, 'auto'
assert_difference 'Auction.count' do
@auction.restart
end
new_auction = Auction.last
assert_equal new_auction.platform, 'auto'
end
def test_restart_new_auction_should_with_auto_if_platform_is_nil
@auction.update(platform: nil)
@auction.reload
assert_nil @auction.platform
assert_difference 'Auction.count' do
@auction.restart
end
new_auction = Auction.last
assert_equal new_auction.platform, 'auto'
end
def test_restarts_an_auction
assert_equal 'auction.test', @auction.domain