mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 03:06:14 +02:00
Improve domain discard
- Extract rake task domain:discard - Remove background job when keeping a domain #790
This commit is contained in:
parent
00a30fc019
commit
e776d09f9d
10 changed files with 104 additions and 46 deletions
|
@ -5,10 +5,25 @@ class DomainDeletableTest < ActiveSupport::TestCase
|
|||
@domain = domains(:shop)
|
||||
end
|
||||
|
||||
def test_discard
|
||||
refute @domain.discarded?
|
||||
def test_discard_domain
|
||||
@domain.discard
|
||||
@domain.reload
|
||||
assert QueJob.find_by("args->>0 = '#{@domain.id}'", job_class: DomainDeleteJob.name)
|
||||
assert @domain.discarded?
|
||||
end
|
||||
|
||||
def test_discard_invalid_domain
|
||||
domain = domains(:invalid)
|
||||
domain.discard
|
||||
domain.reload
|
||||
assert domain.discarded?, 'a domain should be discarded'
|
||||
end
|
||||
|
||||
def test_keep_domain
|
||||
@domain.discard
|
||||
@domain.keep
|
||||
@domain.reload
|
||||
assert_nil QueJob.find_by("args->>0 = '#{@domain.id}'", job_class: DomainDeleteJob.name)
|
||||
refute @domain.discarded?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue