mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Set db cleaning strategy to truncation when running epp tests
This commit is contained in:
parent
b377fda73f
commit
120538bfed
6 changed files with 37 additions and 11 deletions
6
Gemfile
6
Gemfile
|
@ -49,9 +49,11 @@ group :development do
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
#EPP client
|
# For cleaning db in feature and epp tests
|
||||||
gem 'epp', '~> 1.4.0'
|
gem 'database_cleaner', '~> 1.3.0'
|
||||||
|
|
||||||
|
# EPP client
|
||||||
|
gem 'epp', '~> 1.4.0'
|
||||||
|
|
||||||
# Replacement for fixtures
|
# Replacement for fixtures
|
||||||
gem 'fabrication', '~> 2.11.3'
|
gem 'fabrication', '~> 2.11.3'
|
||||||
|
|
|
@ -41,6 +41,7 @@ GEM
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.7.0)
|
coffee-script-source (1.7.0)
|
||||||
columnize (0.8.9)
|
columnize (0.8.9)
|
||||||
|
database_cleaner (1.3.0)
|
||||||
debugger-linecache (1.2.0)
|
debugger-linecache (1.2.0)
|
||||||
diff-lcs (1.2.5)
|
diff-lcs (1.2.5)
|
||||||
epp (1.4.0)
|
epp (1.4.0)
|
||||||
|
@ -178,6 +179,7 @@ PLATFORMS
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
coffee-rails (~> 4.0.0)
|
coffee-rails (~> 4.0.0)
|
||||||
|
database_cleaner (~> 1.3.0)
|
||||||
epp (~> 1.4.0)
|
epp (~> 1.4.0)
|
||||||
fabrication (~> 2.11.3)
|
fabrication (~> 2.11.3)
|
||||||
faker (~> 1.3.0)
|
faker (~> 1.3.0)
|
||||||
|
|
15
README.md
15
README.md
|
@ -79,7 +79,7 @@ For development configuration, add:
|
||||||
EPPEngine On
|
EPPEngine On
|
||||||
EPPCommandRoot /proxy/command
|
EPPCommandRoot /proxy/command
|
||||||
EPPSessionRoot /proxy/session
|
EPPSessionRoot /proxy/session
|
||||||
ProxyPass /proxy/ http://localhost:8080/epp/
|
ProxyPass /proxy/ http://localhost:8989/epp/
|
||||||
|
|
||||||
EPPErrorRoot /cgi-bin/epp/error
|
EPPErrorRoot /cgi-bin/epp/error
|
||||||
EPPAuthURI implicit
|
EPPAuthURI implicit
|
||||||
|
@ -95,11 +95,11 @@ For plain TCP EPP configuration, see below (may be useful for debugging purposes
|
||||||
|
|
||||||
Try it out:
|
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`
|
* `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:
|
Wait for the greeting message on the STD, then send EPP/TCP frame:
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
|
@ -112,7 +112,10 @@ Wait for the greeting message on the STD, then send EPP/TCP frame:
|
||||||
</command></epp>
|
</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>
|
</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.
|
This needs a static greeting file, so you will have to make /var/www writable.
|
||||||
|
|
||||||
```apache
|
```apache
|
||||||
|
|
|
@ -5,7 +5,7 @@ Rails.application.configure do
|
||||||
# test suite. You never need to work with it otherwise. Remember that
|
# 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
|
# 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!
|
# 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
|
# 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
|
# just for the purpose of running a single test. If you are using a tool that
|
||||||
|
|
|
@ -17,7 +17,6 @@ describe 'EPP Session', type: :epp do
|
||||||
|
|
||||||
it 'logs in epp user' do
|
it 'logs in epp user' do
|
||||||
response = Nokogiri::XML(server.send_request(read_body('login.xml')))
|
response = Nokogiri::XML(server.send_request(read_body('login.xml')))
|
||||||
|
|
||||||
result = response.css('epp response result').first
|
result = response.css('epp response result').first
|
||||||
expect(result[:code]).to eq('1000')
|
expect(result[:code]).to eq('1000')
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,27 @@ RSpec.configure do |config|
|
||||||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
# 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
|
# examples within a transaction, remove the following line or assign false
|
||||||
# instead of true.
|
# 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
|
# RSpec Rails can automatically mix in different behaviours to your tests
|
||||||
# based on their file location, for example enabling you to call `get` and
|
# based on their file location, for example enabling you to call `get` and
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue