Add feature test on force delete #2845

This commit is contained in:
Martin Lensment 2015-08-11 11:41:55 +03:00
parent aa54e3c84f
commit 394f30255f
2 changed files with 35 additions and 1 deletions

View file

@ -18,7 +18,7 @@ class Admin::DomainsController < AdminController
normalize_search_parameters do
@q = domains.search(params[:q])
@domains = @q.result.page(params[:page])
if @domains.count == 1
if @domains.count == 1 && params[:q][:name_matches].present?
redirect_to [:admin, @domains.first] and return
elsif @domains.count == 0 && params[:q][:name_matches] !~ /^%.+%$/
# if we do not get any results, add wildcards to the name field and search again

View file

@ -48,4 +48,38 @@ feature 'Domain', type: :feature do
find('.btn.btn-primary').click
current_path.should == "/admin/domains/#{d1.id}"
end
it 'should set domain to force delete' do
d = Fabricate(:domain)
sign_in @user
visit admin_domains_url
click_link d.name
page.should have_content('ok')
click_link 'Set force delete'
page.should have_content('forceDelete')
page.should have_content('serverRenewProhibited')
page.should have_content('serverTransferProhibited')
page.should have_content('serverUpdateProhibited')
page.should have_content('serverManualInzone')
page.should have_content('pendingDelete')
click_link 'Edit statuses'
click_button 'Save'
page.should have_content('Failed to update domain')
page.should have_content('Object status prohibits operation')
click_link 'Back to domain'
click_link 'Unset force delete'
page.should_not have_content('forceDelete')
page.should_not have_content('serverRenewProhibited')
page.should_not have_content('serverTransferProhibited')
page.should_not have_content('serverUpdateProhibited')
page.should_not have_content('serverManualInzone')
page.should_not have_content('pendingDelete')
page.should have_content('ok')
click_link 'Edit statuses'
click_button 'Save'
page.should have_content('Domain updated!')
end
end