Set db cleaning strategy to truncation when running epp tests

This commit is contained in:
Martin Lensment 2014-06-20 15:00:50 +03:00
parent b377fda73f
commit 120538bfed
6 changed files with 37 additions and 11 deletions

View file

@ -49,9 +49,11 @@ group :development do
end
group :development, :test do
#EPP client
gem 'epp', '~> 1.4.0'
# For cleaning db in feature and epp tests
gem 'database_cleaner', '~> 1.3.0'
# EPP client
gem 'epp', '~> 1.4.0'
# Replacement for fixtures
gem 'fabrication', '~> 2.11.3'

View file

@ -41,6 +41,7 @@ GEM
execjs
coffee-script-source (1.7.0)
columnize (0.8.9)
database_cleaner (1.3.0)
debugger-linecache (1.2.0)
diff-lcs (1.2.5)
epp (1.4.0)
@ -178,6 +179,7 @@ PLATFORMS
DEPENDENCIES
coffee-rails (~> 4.0.0)
database_cleaner (~> 1.3.0)
epp (~> 1.4.0)
fabrication (~> 2.11.3)
faker (~> 1.3.0)

View file

@ -79,7 +79,7 @@ For development configuration, add:
EPPEngine On
EPPCommandRoot /proxy/command
EPPSessionRoot /proxy/session
ProxyPass /proxy/ http://localhost:8080/epp/
ProxyPass /proxy/ http://localhost:8989/epp/
EPPErrorRoot /cgi-bin/epp/error
EPPAuthURI implicit
@ -95,11 +95,11 @@ For plain TCP EPP configuration, see below (may be useful for debugging purposes
Try it out:
* Fire up your appserver (This setup is tested with Unicorn)
* Fire up your appserver on port 8989 (This setup is tested with Unicorn)
* `cd $mod_epp`
* `./epptelnet.pl localhost 1701`
* `./epptelnet.pl localhost`
You should receive the greeting from the registry server.
You should receive the greeting from the registry server.
Wait for the greeting message on the STD, then send EPP/TCP frame:
```xml
@ -112,7 +112,10 @@ Wait for the greeting message on the STD, then send EPP/TCP frame:
</command></epp>
```
* `rspec` to run tests
Because Apache can not call the same process where the rspec is running (worker is busy), another instance of the appserver must be initialized before running tests.
* `unicorn -p 8989 -E test`
* `rspec`
---
@ -141,7 +144,7 @@ Add:
</IfModule>
```
For debugging purposes, standalone CGI scripts can be used:
For debugging purposes, standalone CGI scripts can be used:
This needs a static greeting file, so you will have to make /var/www writable.
```apache

View file

@ -5,7 +5,7 @@ Rails.application.configure do
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
config.cache_classes = false
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that

View file

@ -17,7 +17,6 @@ describe 'EPP Session', type: :epp do
it 'logs in epp user' do
response = Nokogiri::XML(server.send_request(read_body('login.xml')))
result = response.css('epp response result').first
expect(result[:code]).to eq('1000')

View file

@ -25,7 +25,27 @@ RSpec.configure do |config|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, type: :epp) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and