Updated spec and rails helper

This commit is contained in:
Priit Tark 2015-01-27 11:26:21 +02:00
parent 221c62c846
commit 155cb812d9
5 changed files with 32 additions and 28 deletions

View file

@ -2,9 +2,6 @@ require 'rails_helper'
describe 'EPP Contact', epp: true do describe 'EPP Contact', epp: true do
before :all do before :all do
DatabaseCleaner.clean_with(:truncation)
DatabaseCleaner.strategy = nil
Fabricate(:epp_user) Fabricate(:epp_user)
Fabricate(:epp_user, username: 'registrar1', registrar: registrar1) Fabricate(:epp_user, username: 'registrar1', registrar: registrar1)
Fabricate(:epp_user, username: 'registrar2', registrar: registrar2) Fabricate(:epp_user, username: 'registrar2', registrar: registrar2)
@ -82,11 +79,9 @@ describe 'EPP Contact', epp: true do
log.length.should == 1 log.length.should == 1
log[0].request_command.should == 'create' log[0].request_command.should == 'create'
log[0].request_object.should == 'contact' log[0].request_object.should == 'contact'
log[0].request_successful.should == 'true' log[0].request_successful.should == true
log[0].api_user_name.should == 'registrar1' log[0].api_user_name.should == 'gitlab'
log[0].api_user_registrar.should == 'Registrar OÜ' log[0].api_user_registrar.should == 'Registrar OÜ'
log[0].request.should be_blank
log[0].response.should be_blank
end end
it 'successfully adds registrar' do it 'successfully adds registrar' do

View file

@ -1,6 +1,5 @@
require 'rails_helper' require 'rails_helper'
describe 'EPP Keyrelay', epp: true do describe 'EPP Keyrelay', epp: true do
let(:server_zone) { Epp::Server.new({ server: 'localhost', tag: 'zone', password: 'ghyt9e4fu', port: 701 }) } 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 }) } let(:server_elkdata) { Epp::Server.new({ server: 'localhost', tag: 'elkdata', password: 'ghyt9e4fu', port: 701 }) }
@ -9,8 +8,6 @@ describe 'EPP Keyrelay', epp: true do
before(:each) { create_settings } before(:each) { create_settings }
before(:all) do before(:all) do
DatabaseCleaner.clean_with(:truncation)
DatabaseCleaner.strategy = nil
@elkdata = Fabricate(:registrar, { name: 'Elkdata', reg_no: '123' }) @elkdata = Fabricate(:registrar, { name: 'Elkdata', reg_no: '123' })
@zone = Fabricate(:registrar) @zone = Fabricate(:registrar)
Fabricate(:epp_user, username: 'zone', registrar: @zone) Fabricate(:epp_user, username: 'zone', registrar: @zone)

View file

@ -17,6 +17,7 @@ describe 'EPP Poll', epp: true do
end end
it 'returns no messages in poll' do it 'returns no messages in poll' do
ApiLog::EppLog.delete_all
response = epp_request(epp_xml.poll, :xml) response = epp_request(epp_xml.poll, :xml)
expect(response[:msg]).to eq('Command completed successfully; no messages') expect(response[:msg]).to eq('Command completed successfully; no messages')

View file

@ -1,6 +1,11 @@
require 'rails_helper' require 'rails_helper'
describe Contact do describe Contact do
before :all do
# DatabaseCleaner.clean_with(:truncation)
# DatabaseCleaner.strategy = :transaction
end
before { create_disclosure_settings } before { create_disclosure_settings }
it { should have_one(:address) } it { should have_one(:address) }

View file

@ -33,30 +33,36 @@ RSpec.configure do |config|
config.before(:suite) do config.before(:suite) do
ActiveRecord::Base.establish_connection :api_log_test ActiveRecord::Base.establish_connection :api_log_test
DatabaseCleaner.strategy = :deletion DatabaseCleaner.clean_with(:truncation)
DatabaseCleaner.strategy = nil
ActiveRecord::Base.establish_connection :test ActiveRecord::Base.establish_connection :test
end
config.before(:all) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:all, epp: true) do
DatabaseCleaner.strategy = nil
end
config.before(:each, js: true) do
DatabaseCleaner.strategy = :truncation DatabaseCleaner.strategy = :truncation
end end
# config.before(:each) do config.before(:each, type: :request) do
# DatabaseCleaner.strategy = :transaction DatabaseCleaner.strategy = :truncation
# end end
# config.before(:all, epp: true) do config.before(:each, type: :model) do
# ActiveRecord::Base.establish_connection :api_log_test DatabaseCleaner.strategy = :transaction
# DatabaseCleaner.clean DatabaseCleaner.start
end
# ActiveRecord::Base.establish_connection :test config.after(:each, type: :model) do
# DatabaseCleaner.clean DatabaseCleaner.clean
# end end
# config.before(:each, js: true) do
# DatabaseCleaner.strategy = :truncation
# end
# config.before(:each, type: :request) do
# DatabaseCleaner.strategy = :truncation
# end
Capybara.javascript_driver = :poltergeist Capybara.javascript_driver = :poltergeist