Added manual database cleaning + Api log spec updates

This commit is contained in:
Priit Tark 2015-01-26 17:55:27 +02:00
parent 06d9cbe2f0
commit 221c62c846
3 changed files with 30 additions and 37 deletions

View file

@ -63,6 +63,7 @@ describe 'EPP Contact', epp: true do
end
it 'successfully creates a contact' do
ApiLog::EppLog.delete_all
response = epp_plain_request(create_contact_xml, :xml)
response[:msg].should == 'Command completed successfully'
@ -76,29 +77,16 @@ describe 'EPP Contact', epp: true do
@contact.ident.should == '37605030299'
@contact.address.street.should == '123 Example'
# log = ApiLog::EppLog.all
log = ApiLog::EppLog.all
# log.length.should == 4
# log[0].request_command.should == 'hello'
# log[0].request_successful.should == true
# log[1].request_command).to eq('login')
# log[1].request_successful).to eq(true)
# log[1].api_user_name).to eq('registrar1')
# log[1].api_user_registrar).to eq('Registrar OÜ')
# log[2].request_command).to eq('create')
# log[2].request_object).to eq('contact')
# log[2].request_successful).to eq(true)
# log[2].api_user_name).to eq('registrar1')
# log[2].api_user_registrar).to eq('Registrar OÜ')
# log[2].request).not_to be_blank
# log[2].response).not_to be_blank
# log[3].request_command).to eq('logout')
# log[3].request_successful).to eq(true)
# log[3].api_user_name).to eq('registrar1')
# log[3].api_user_registrar).to eq('Registrar OÜ')
log.length.should == 1
log[0].request_command.should == 'create'
log[0].request_object.should == 'contact'
log[0].request_successful.should == 'true'
log[0].api_user_name.should == 'registrar1'
log[0].api_user_registrar.should == 'Registrar OÜ'
log[0].request.should be_blank
log[0].response.should be_blank
end
it 'successfully adds registrar' do

View file

@ -1,5 +1,6 @@
require 'rails_helper'
describe 'EPP Keyrelay', epp: true do
let(:server_zone) { Epp::Server.new({ server: 'localhost', tag: 'zone', password: 'ghyt9e4fu', port: 701 }) }
let(:server_elkdata) { Epp::Server.new({ server: 'localhost', tag: 'elkdata', password: 'ghyt9e4fu', port: 701 }) }
@ -8,6 +9,8 @@ describe 'EPP Keyrelay', epp: true do
before(:each) { create_settings }
before(:all) do
DatabaseCleaner.clean_with(:truncation)
DatabaseCleaner.strategy = nil
@elkdata = Fabricate(:registrar, { name: 'Elkdata', reg_no: '123' })
@zone = Fabricate(:registrar)
Fabricate(:epp_user, username: 'zone', registrar: @zone)
@ -20,6 +23,8 @@ describe 'EPP Keyrelay', epp: true do
let(:domain) { Domain.last }
it 'makes a keyrelay request' do
ApiLog::EppLog.delete_all
xml = epp_xml.keyrelay({
name: { value: domain.name },
keyData: {

View file

@ -38,25 +38,25 @@ RSpec.configure do |config|
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
# config.before(:each) do
# DatabaseCleaner.strategy = :transaction
# end
config.before(:all, epp: true) do
ActiveRecord::Base.establish_connection :api_log_test
DatabaseCleaner.clean
# config.before(:all, epp: true) do
# ActiveRecord::Base.establish_connection :api_log_test
# DatabaseCleaner.clean
ActiveRecord::Base.establish_connection :test
DatabaseCleaner.clean
end
# ActiveRecord::Base.establish_connection :test
# DatabaseCleaner.clean
# end
config.before(:each, js: true) do
DatabaseCleaner.strategy = :truncation
end
# config.before(:each, js: true) do
# DatabaseCleaner.strategy = :truncation
# end
config.before(:each, type: :request) do
DatabaseCleaner.strategy = :truncation
end
# config.before(:each, type: :request) do
# DatabaseCleaner.strategy = :truncation
# end
Capybara.javascript_driver = :poltergeist