mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +02:00
Merge branch 'replace-warden-helpers-with-devise' into registry-790
# Conflicts: # test/integration/admin/domains_test.rb
This commit is contained in:
commit
eddf39ea9b
51 changed files with 53 additions and 52 deletions
|
@ -32,6 +32,8 @@ RSpec.configure do |config|
|
|||
config.include AbstractController::Translation, type: :mailer
|
||||
config.include Requests::EPPHelpers, epp: true
|
||||
config.include Matchers::EPP, epp: true
|
||||
config.include Devise::Test::IntegrationHelpers, type: :feature
|
||||
config.include Devise::Test::IntegrationHelpers, type: :request
|
||||
|
||||
config.define_derived_metadata(file_path: %r[/spec/features/]) do |metadata|
|
||||
metadata[:db] = true if metadata[:db].nil?
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe 'EPP contact:create' do
|
|||
|
||||
before do
|
||||
Setting.address_processing = false
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when all ident params are valid' do
|
||||
|
|
|
@ -30,7 +30,7 @@ RSpec.describe 'EPP contact:create' do
|
|||
}
|
||||
|
||||
before do
|
||||
login_as user
|
||||
sign_in user
|
||||
allow(Contact).to receive(:address_processing?).and_return(false)
|
||||
end
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ RSpec.describe 'EPP contact:create' do
|
|||
subject(:address_saved) { Contact.last.attributes.slice(*Contact.address_attribute_names).compact.any? }
|
||||
|
||||
before do
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when address processing is enabled' do
|
||||
|
|
|
@ -21,7 +21,7 @@ RSpec.describe 'EPP contact:delete' do
|
|||
}
|
||||
|
||||
before do
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when contact is used' do
|
||||
|
|
|
@ -22,7 +22,7 @@ RSpec.describe 'EPP contact:update' do
|
|||
.count }
|
||||
|
||||
before do
|
||||
login_as user
|
||||
sign_in user
|
||||
create(:contact, code: 'TEST')
|
||||
end
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ RSpec.describe 'EPP contact:update' do
|
|||
}
|
||||
|
||||
before do
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when contact ident is valid' do
|
||||
|
|
|
@ -25,7 +25,7 @@ RSpec.describe 'EPP contact:update' do
|
|||
}
|
||||
|
||||
before do
|
||||
login_as user
|
||||
sign_in user
|
||||
allow(Contact).to receive(:address_processing?).and_return(false)
|
||||
end
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ RSpec.describe 'EPP contact:update' do
|
|||
subject(:response_description) { response_xml.css('result msg').text }
|
||||
|
||||
before do
|
||||
login_as user
|
||||
sign_in user
|
||||
create(:contact, code: 'TEST')
|
||||
end
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ RSpec.describe 'EPP domain:create', settings: false do
|
|||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010')
|
||||
Setting.days_to_renew_domain_before_expire = 0
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when account balance is sufficient' do
|
||||
|
|
|
@ -38,7 +38,7 @@ RSpec.describe 'EPP domain:create', settings: false do
|
|||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010 10:30')
|
||||
Setting.days_to_renew_domain_before_expire = 0
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when period is absent' do
|
||||
|
|
|
@ -18,7 +18,7 @@ RSpec.describe 'EPP domain:create', settings: false do
|
|||
|
||||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010')
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when nameserver is optional' do
|
||||
|
|
|
@ -11,7 +11,7 @@ RSpec.describe 'EPP domain:create', settings: false do
|
|||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010 10:30')
|
||||
Setting.days_to_renew_domain_before_expire = 0
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when period is 3 months' do
|
||||
|
|
|
@ -31,7 +31,7 @@ RSpec.describe 'EPP domain:create', settings: false do
|
|||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010')
|
||||
Setting.days_to_renew_domain_before_expire = 0
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when price is present' do
|
||||
|
|
|
@ -18,7 +18,7 @@ RSpec.describe 'EPP domain:create', settings: false do
|
|||
|
||||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010')
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when nameserver is required' do
|
||||
|
|
|
@ -17,7 +17,7 @@ RSpec.describe 'EPP domain:renew' do
|
|||
before :example do
|
||||
Setting.days_to_renew_domain_before_expire = 0
|
||||
travel_to Time.zone.parse('05.07.2010')
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when account balance is sufficient' do
|
||||
|
|
|
@ -38,7 +38,7 @@ RSpec.describe 'EPP domain:renew', settings: false do
|
|||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010')
|
||||
Setting.days_to_renew_domain_before_expire = 0
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when period is absent' do
|
||||
|
|
|
@ -18,7 +18,7 @@ RSpec.describe 'EPP domain:renew' do
|
|||
before :example do
|
||||
Setting.days_to_renew_domain_before_expire = 0
|
||||
travel_to Time.zone.parse('05.07.2010')
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when given expire time and current match' do
|
||||
|
|
|
@ -20,7 +20,7 @@ RSpec.describe 'EPP domain:renew' do
|
|||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010')
|
||||
Setting.days_to_renew_domain_before_expire = 0
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when domain can be renewed' do
|
||||
|
|
|
@ -15,7 +15,7 @@ RSpec.describe 'EPP domain:renew', settings: false do
|
|||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010')
|
||||
Setting.days_to_renew_domain_before_expire = 0
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when period is 3 months' do
|
||||
|
|
|
@ -30,7 +30,7 @@ RSpec.describe 'EPP domain:renew', settings: false do
|
|||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010')
|
||||
Setting.days_to_renew_domain_before_expire = 0
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when price is present' do
|
||||
|
|
|
@ -10,7 +10,7 @@ RSpec.describe 'EPP domain:update' do
|
|||
subject(:response_description) { response_xml.css('result msg').text }
|
||||
|
||||
before :example do
|
||||
login_as user
|
||||
sign_in user
|
||||
|
||||
allow(Domain).to receive(:nameserver_required?).and_return(false)
|
||||
Setting.ns_min_count = 2
|
||||
|
|
|
@ -9,7 +9,7 @@ RSpec.describe 'EPP domain:update' do
|
|||
subject(:response_description) { response_xml.css('result msg').text }
|
||||
|
||||
before :example do
|
||||
login_as user
|
||||
sign_in user
|
||||
allow(Domain).to receive(:nameserver_required?).and_return(false)
|
||||
end
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe 'EPP domain:update' do
|
|||
let!(:domain) { create(:domain, name: 'test.com', registrant: registrant) }
|
||||
|
||||
before :example do
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when registrant change confirmation is enabled' do
|
||||
|
|
|
@ -10,7 +10,7 @@ RSpec.describe 'EPP domain:update' do
|
|||
let!(:new_registrant) { create(:registrant, code: 'new-code') }
|
||||
|
||||
before :example do
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when registrant change confirmation is enabled' do
|
||||
|
|
|
@ -20,7 +20,7 @@ RSpec.describe 'EPP domain:update' do
|
|||
}
|
||||
|
||||
before :example do
|
||||
login_as user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
context 'when domain has both SERVER_DELETE_PROHIBITED and PENDING_UPDATE statuses' do
|
||||
|
|
|
@ -20,7 +20,7 @@ module Features
|
|||
|
||||
def sign_in_to_registrant_area
|
||||
user = create(:registrant_user)
|
||||
login_as(user, scope: :user)
|
||||
sign_in(user, scope: :user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ class ContactVersionsTest < ActionDispatch::IntegrationTest
|
|||
super
|
||||
|
||||
create_contact_with_history
|
||||
login_as users(:admin)
|
||||
sign_in users(:admin)
|
||||
end
|
||||
|
||||
def teardown
|
||||
|
|
|
@ -5,7 +5,7 @@ class AdminContactsTest < ActionDispatch::IntegrationTest
|
|||
super
|
||||
|
||||
@contact = contacts(:william)
|
||||
login_as users(:admin)
|
||||
sign_in users(:admin)
|
||||
end
|
||||
|
||||
def test_display_list
|
||||
|
|
|
@ -5,7 +5,7 @@ class DomainVersionsTest < ActionDispatch::IntegrationTest
|
|||
super
|
||||
|
||||
create_domain_with_history
|
||||
login_as users(:admin)
|
||||
sign_in users(:admin)
|
||||
end
|
||||
|
||||
def teardown
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
class AdminAreaDomainDetailsTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
login_as users(:admin)
|
||||
sign_in users(:admin)
|
||||
@domain = domains(:shop)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ class AdminAreaDomainForceDeleteTest < ActionDispatch::IntegrationTest
|
|||
include ActionMailer::TestHelper
|
||||
|
||||
setup do
|
||||
login_as users(:admin)
|
||||
sign_in users(:admin)
|
||||
@domain = domains(:shop)
|
||||
ActionMailer::Base.deliveries.clear
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
class AdminDomainsTestTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
login_as users(:admin)
|
||||
sign_in users(:admin)
|
||||
@domain = domains(:shop)
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
class AdminAreaNewMailTemplateTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
login_as users(:admin)
|
||||
sign_in users(:admin)
|
||||
end
|
||||
|
||||
def test_new_mail_template_does_not_throw_template_error
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
class AdminAreaDeleteRegistrarTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
login_as users(:admin)
|
||||
sign_in users(:admin)
|
||||
end
|
||||
|
||||
def test_can_be_deleted_when_not_in_use
|
||||
|
|
|
@ -4,7 +4,7 @@ class AdminAreaRegistrarDetailsTest < ActionDispatch::IntegrationTest
|
|||
include ActionView::Helpers::NumberHelper
|
||||
|
||||
setup do
|
||||
login_as users(:admin)
|
||||
sign_in users(:admin)
|
||||
@registrar = registrars(:complete)
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
class AdminAreaEditRegistrarTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
login_as users(:admin)
|
||||
sign_in users(:admin)
|
||||
@registrar = registrars(:bestnames)
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
class AdminAreaNewRegistrarTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
login_as users(:admin)
|
||||
sign_in users(:admin)
|
||||
end
|
||||
|
||||
def test_new_registrar_creation_with_required_params
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
class RegistrantDomainsTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
login_as users(:registrant)
|
||||
sign_in users(:registrant)
|
||||
|
||||
Setting.days_to_keep_business_registry_cache = 1
|
||||
travel_to Time.zone.parse('2010-07-05')
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'test_helper'
|
|||
class RegistrantLayoutTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
super
|
||||
login_as(users(:registrant))
|
||||
sign_in(users(:registrant))
|
||||
|
||||
Setting.days_to_keep_business_registry_cache = 1
|
||||
travel_to Time.zone.parse('2010-07-05')
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
class BalanceTopUpTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
login_as users(:api_bestnames)
|
||||
sign_in users(:api_bestnames)
|
||||
end
|
||||
|
||||
def test_creates_new_invoice
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
class RegistrarAreaBulkTransferTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
login_as users(:api_goodnames)
|
||||
sign_in users(:api_goodnames)
|
||||
end
|
||||
|
||||
def test_transfer_multiple_domains_in_bulk
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
class RegistrarAreaNameserverBulkChangeTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
login_as users(:api_goodnames)
|
||||
sign_in users(:api_goodnames)
|
||||
end
|
||||
|
||||
def test_replaces_current_registrar_nameservers
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
class RegistrarAreaTechContactBulkChangeTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
login_as users(:api_bestnames)
|
||||
sign_in users(:api_bestnames)
|
||||
end
|
||||
|
||||
def test_replace_domain_contacts_of_current_registrar
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
class RegistrarDomainsTest < ActionDispatch::IntegrationTest
|
||||
def test_downloads_domain_list_as_csv
|
||||
login_as users(:api_bestnames)
|
||||
sign_in users(:api_bestnames)
|
||||
travel_to Time.zone.parse('2010-07-05 10:30')
|
||||
|
||||
expected_csv = <<-CSV.strip_heredoc
|
||||
|
|
|
@ -6,7 +6,7 @@ class ListInvoicesTest < ActionDispatch::IntegrationTest
|
|||
|
||||
@user = users(:api_bestnames)
|
||||
@registrar_invoices = @user.registrar.invoices
|
||||
login_as @user
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
def test_show_balance
|
||||
|
|
|
@ -7,7 +7,7 @@ class NewInvoicePaymentTest < ActionDispatch::IntegrationTest
|
|||
@original_vat_prc = Setting.registry_vat_prc
|
||||
Setting.registry_vat_prc = 0.2
|
||||
@user = users(:api_bestnames)
|
||||
login_as @user
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
def teardown
|
||||
|
|
|
@ -5,7 +5,7 @@ class NewInvoiceTest < ActionDispatch::IntegrationTest
|
|||
super
|
||||
|
||||
@user = users(:api_bestnames)
|
||||
login_as @user
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
def test_show_balance
|
||||
|
|
|
@ -5,7 +5,7 @@ class PaymentCallbackTest < ActionDispatch::IntegrationTest
|
|||
super
|
||||
|
||||
@user = users(:api_bestnames)
|
||||
login_as @user
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
def create_invoice_with_items
|
||||
|
|
|
@ -5,7 +5,7 @@ class PaymentReturnTest < ActionDispatch::IntegrationTest
|
|||
super
|
||||
|
||||
@user = users(:api_bestnames)
|
||||
login_as @user
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
def create_invoice_with_items
|
||||
|
|
|
@ -28,13 +28,12 @@ class ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
class ActionDispatch::IntegrationTest
|
||||
include Warden::Test::Helpers
|
||||
include Capybara::DSL
|
||||
include Capybara::Minitest::Assertions
|
||||
include AbstractController::Translation
|
||||
include Devise::Test::IntegrationHelpers
|
||||
|
||||
teardown do
|
||||
Warden.test_reset!
|
||||
WebMock.reset!
|
||||
Capybara.reset_sessions!
|
||||
Capybara.use_default_driver
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue