mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 14:06:21 +02:00
added tests
This commit is contained in:
parent
35408343e3
commit
55657bd8ef
2 changed files with 44 additions and 1 deletions
|
@ -28,7 +28,7 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
||||||
assert_equal ({ 'id' => '1b3ee442-e8fe-4922-9492-8fcb9dccc69c',
|
assert_equal ({ 'id' => '1b3ee442-e8fe-4922-9492-8fcb9dccc69c',
|
||||||
'domain' => 'auction.test',
|
'domain' => 'auction.test',
|
||||||
'status' => Auction.statuses[:awaiting_payment],
|
'status' => Auction.statuses[:awaiting_payment],
|
||||||
'platform' => nil }), ActiveSupport::JSON.decode(response.body)
|
'platform' => "auto" }), ActiveSupport::JSON.decode(response.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_marks_as_awaiting_payment
|
def test_marks_as_awaiting_payment
|
||||||
|
|
|
@ -131,6 +131,49 @@ class AuctionTest < ActiveSupport::TestCase
|
||||||
assert_not @auction.domain_registrable?('')
|
assert_not @auction.domain_registrable?('')
|
||||||
end
|
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
|
def test_restarts_an_auction
|
||||||
assert_equal 'auction.test', @auction.domain
|
assert_equal 'auction.test', @auction.domain
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue