mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Merge branch 'master' of github.com:internetee/registry
This commit is contained in:
commit
70d600c487
13 changed files with 130 additions and 36 deletions
11
Gemfile
11
Gemfile
|
@ -60,6 +60,11 @@ group :development do
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
|
gem 'capybara', '~> 2.4.1'
|
||||||
|
# For feature testing
|
||||||
|
# gem 'capybara-webkit', '1.2.0' # Webkit driver didn't work with turbolinks
|
||||||
|
gem 'poltergeist', '~> 1.5.1' # We are using PhantomJS instead
|
||||||
|
|
||||||
# For cleaning db in feature and epp tests
|
# For cleaning db in feature and epp tests
|
||||||
gem 'database_cleaner', '~> 1.3.0'
|
gem 'database_cleaner', '~> 1.3.0'
|
||||||
|
|
||||||
|
@ -73,11 +78,11 @@ group :development, :test do
|
||||||
gem 'faker', '~> 1.3.0'
|
gem 'faker', '~> 1.3.0'
|
||||||
|
|
||||||
# For debugging
|
# For debugging
|
||||||
gem 'pry'
|
gem 'pry', '~> 0.10.1'
|
||||||
gem 'pry-byebug'
|
gem 'pry-byebug', '~> 1.3.3'
|
||||||
|
|
||||||
# Testing framework
|
# Testing framework
|
||||||
gem 'rspec-rails', '~> 3.0.1'
|
gem 'rspec-rails', '~> 3.0.2'
|
||||||
|
|
||||||
# Additional matchers for RSpec
|
# Additional matchers for RSpec
|
||||||
gem 'shoulda-matchers', '~> 2.6.1', require: false
|
gem 'shoulda-matchers', '~> 2.6.1', require: false
|
||||||
|
|
51
Gemfile.lock
51
Gemfile.lock
|
@ -34,6 +34,13 @@ GEM
|
||||||
byebug (2.7.0)
|
byebug (2.7.0)
|
||||||
columnize (~> 0.3)
|
columnize (~> 0.3)
|
||||||
debugger-linecache (~> 1.2)
|
debugger-linecache (~> 1.2)
|
||||||
|
capybara (2.4.1)
|
||||||
|
mime-types (>= 1.16)
|
||||||
|
nokogiri (>= 1.3.3)
|
||||||
|
rack (>= 1.0.0)
|
||||||
|
rack-test (>= 0.5.4)
|
||||||
|
xpath (~> 2.0)
|
||||||
|
cliver (0.3.2)
|
||||||
coderay (1.1.0)
|
coderay (1.1.0)
|
||||||
coffee-rails (4.0.1)
|
coffee-rails (4.0.1)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
|
@ -63,7 +70,7 @@ GEM
|
||||||
railties (>= 4.0.1)
|
railties (>= 4.0.1)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
hpricot (0.8.6)
|
hpricot (0.8.6)
|
||||||
i18n (0.6.9)
|
i18n (0.6.11)
|
||||||
isikukood (0.1.2)
|
isikukood (0.1.2)
|
||||||
jbuilder (2.1.1)
|
jbuilder (2.1.1)
|
||||||
activesupport (>= 3.0.0, < 5)
|
activesupport (>= 3.0.0, < 5)
|
||||||
|
@ -81,19 +88,24 @@ GEM
|
||||||
method_source (0.8.2)
|
method_source (0.8.2)
|
||||||
mime-types (1.25.1)
|
mime-types (1.25.1)
|
||||||
mini_portile (0.6.0)
|
mini_portile (0.6.0)
|
||||||
minitest (5.3.5)
|
minitest (5.4.0)
|
||||||
multi_json (1.10.1)
|
multi_json (1.10.1)
|
||||||
nokogiri (1.6.2.1)
|
nokogiri (1.6.2.1)
|
||||||
mini_portile (= 0.6.0)
|
mini_portile (= 0.6.0)
|
||||||
pg (0.17.1)
|
pg (0.17.1)
|
||||||
|
poltergeist (1.5.1)
|
||||||
|
capybara (~> 2.1)
|
||||||
|
cliver (~> 0.3.1)
|
||||||
|
multi_json (~> 1.0)
|
||||||
|
websocket-driver (>= 0.2.0)
|
||||||
polyglot (0.3.5)
|
polyglot (0.3.5)
|
||||||
pry (0.9.12.6)
|
pry (0.10.1)
|
||||||
coderay (~> 1.0)
|
coderay (~> 1.1.0)
|
||||||
method_source (~> 0.8)
|
method_source (~> 0.8.1)
|
||||||
slop (~> 3.4)
|
slop (~> 3.4)
|
||||||
pry-byebug (1.3.2)
|
pry-byebug (1.3.3)
|
||||||
byebug (~> 2.7)
|
byebug (~> 2.7)
|
||||||
pry (~> 0.9.12)
|
pry (~> 0.10)
|
||||||
rack (1.5.2)
|
rack (1.5.2)
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
|
@ -117,14 +129,14 @@ GEM
|
||||||
rdoc (4.1.1)
|
rdoc (4.1.1)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
ref (1.0.5)
|
ref (1.0.5)
|
||||||
rspec-core (3.0.1)
|
rspec-core (3.0.4)
|
||||||
rspec-support (~> 3.0.0)
|
rspec-support (~> 3.0.0)
|
||||||
rspec-expectations (3.0.1)
|
rspec-expectations (3.0.4)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.0.0)
|
rspec-support (~> 3.0.0)
|
||||||
rspec-mocks (3.0.1)
|
rspec-mocks (3.0.4)
|
||||||
rspec-support (~> 3.0.0)
|
rspec-support (~> 3.0.0)
|
||||||
rspec-rails (3.0.1)
|
rspec-rails (3.0.2)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
|
@ -132,7 +144,7 @@ GEM
|
||||||
rspec-expectations (~> 3.0.0)
|
rspec-expectations (~> 3.0.0)
|
||||||
rspec-mocks (~> 3.0.0)
|
rspec-mocks (~> 3.0.0)
|
||||||
rspec-support (~> 3.0.0)
|
rspec-support (~> 3.0.0)
|
||||||
rspec-support (3.0.0)
|
rspec-support (3.0.4)
|
||||||
sass (3.2.19)
|
sass (3.2.19)
|
||||||
sass-rails (4.0.3)
|
sass-rails (4.0.3)
|
||||||
railties (>= 4.0.0, < 5.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
|
@ -145,7 +157,7 @@ GEM
|
||||||
shoulda-matchers (2.6.1)
|
shoulda-matchers (2.6.1)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
simpleidn (0.0.5)
|
simpleidn (0.0.5)
|
||||||
slop (3.5.0)
|
slop (3.6.0)
|
||||||
spring (1.1.3)
|
spring (1.1.3)
|
||||||
sprockets (2.11.0)
|
sprockets (2.11.0)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
|
@ -167,7 +179,7 @@ GEM
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
turbolinks (2.2.2)
|
turbolinks (2.2.2)
|
||||||
coffee-rails
|
coffee-rails
|
||||||
tzinfo (1.2.1)
|
tzinfo (1.2.2)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
uglifier (2.5.1)
|
uglifier (2.5.1)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
|
@ -177,12 +189,16 @@ GEM
|
||||||
rack
|
rack
|
||||||
raindrops (~> 0.7)
|
raindrops (~> 0.7)
|
||||||
uuidtools (2.1.4)
|
uuidtools (2.1.4)
|
||||||
|
websocket-driver (0.3.4)
|
||||||
|
xpath (2.0.0)
|
||||||
|
nokogiri (~> 1.3)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
bootstrap-sass (~> 3.2.0.1)
|
bootstrap-sass (~> 3.2.0.1)
|
||||||
|
capybara (~> 2.4.1)
|
||||||
coffee-rails (~> 4.0.0)
|
coffee-rails (~> 4.0.0)
|
||||||
database_cleaner (~> 1.3.0)
|
database_cleaner (~> 1.3.0)
|
||||||
epp (~> 1.4.0)
|
epp (~> 1.4.0)
|
||||||
|
@ -194,10 +210,11 @@ DEPENDENCIES
|
||||||
jquery-rails
|
jquery-rails
|
||||||
nokogiri (~> 1.6.2.1)
|
nokogiri (~> 1.6.2.1)
|
||||||
pg
|
pg
|
||||||
pry
|
poltergeist (~> 1.5.1)
|
||||||
pry-byebug
|
pry (~> 0.10.1)
|
||||||
|
pry-byebug (~> 1.3.3)
|
||||||
rails (= 4.1.4)
|
rails (= 4.1.4)
|
||||||
rspec-rails (~> 3.0.1)
|
rspec-rails (~> 3.0.2)
|
||||||
sass-rails (~> 4.0.3)
|
sass-rails (~> 4.0.3)
|
||||||
sdoc (~> 0.4.0)
|
sdoc (~> 0.4.0)
|
||||||
shoulda-matchers (~> 2.6.1)
|
shoulda-matchers (~> 2.6.1)
|
||||||
|
|
|
@ -117,6 +117,13 @@ Wait for the greeting message on the STD, then send EPP/TCP frame:
|
||||||
<clTRID>sample1trid</clTRID>
|
<clTRID>sample1trid</clTRID>
|
||||||
</command></epp>
|
</command></epp>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Testing
|
||||||
|
---
|
||||||
|
For feature testing, PhantomJS is used.
|
||||||
|
|
||||||
|
* [Download](https://bitbucket.org/ariya/phantomjs/downloads/) the correct binary for your OS
|
||||||
|
* Move the binary to `/usr/local/bin`
|
||||||
* Before running tests for the first time: `rake db:seed`
|
* Before running tests for the first time: `rake db:seed`
|
||||||
* Run tests: `rake`
|
* Run tests: `rake`
|
||||||
* Run EPP tests: `rake test:epp`
|
* Run EPP tests: `rake test:epp`
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
- @setting_group.settings.each do |setting|
|
- @setting_group.settings.each do |setting|
|
||||||
= f.fields_for :settings, setting do |sf|
|
= f.fields_for :settings, setting do |sf|
|
||||||
%tr
|
%tr
|
||||||
%td= t("settings.codes.#{sf.object.code}")
|
%td= sf.label :value, t("settings.codes.#{sf.object.code}")
|
||||||
%td= sf.text_field(:value, autocomplete: 'off')
|
%td= sf.text_field(:value, autocomplete: 'off')
|
||||||
.row
|
.row
|
||||||
.col-md-12.text-right
|
.col-md-12.text-right
|
||||||
|
|
|
@ -86,7 +86,7 @@ en:
|
||||||
|
|
||||||
setting_groups:
|
setting_groups:
|
||||||
codes:
|
codes:
|
||||||
domain_statuses: 'Domain statuses'
|
domain_validation: 'Domain validation'
|
||||||
|
|
||||||
index:
|
index:
|
||||||
setting_group: 'Setting group'
|
setting_group: 'Setting group'
|
||||||
|
|
|
@ -78,6 +78,7 @@ describe 'EPP Contact', epp: true do
|
||||||
expect(response[:results].count).to eq 1
|
expect(response[:results].count).to eq 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
it 'fails with wrong authentication info' do
|
it 'fails with wrong authentication info' do
|
||||||
Fabricate(:contact, code: 'sh8013', auth_info: 'secure_password')
|
Fabricate(:contact, code: 'sh8013', auth_info: 'secure_password')
|
||||||
|
|
||||||
|
|
3
spec/fabricators/setting_fabricator.rb
Normal file
3
spec/fabricators/setting_fabricator.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Fabricator(:setting) do
|
||||||
|
code 'ns_min_count'
|
||||||
|
end
|
7
spec/fabricators/setting_group_fabricator.rb
Normal file
7
spec/fabricators/setting_group_fabricator.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Fabricator(:setting_group) do
|
||||||
|
code 'domain_validation'
|
||||||
|
settings { [
|
||||||
|
Fabricate(:setting, code: 'ns_min_count', value: 1),
|
||||||
|
Fabricate(:setting, code: 'ns_max_count', value: 13)
|
||||||
|
]}
|
||||||
|
end
|
37
spec/features/setting_management_spec.rb
Normal file
37
spec/features/setting_management_spec.rb
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
feature 'Setting management' do
|
||||||
|
background { Fabricate(:setting_group) }
|
||||||
|
|
||||||
|
scenario 'User changes a setting', js: true do
|
||||||
|
visit root_path
|
||||||
|
|
||||||
|
# This ensures javascript works correctly
|
||||||
|
expect(page).to have_no_link 'Setting groups'
|
||||||
|
click_on 'Settings'
|
||||||
|
expect(page).to have_link 'Setting groups'
|
||||||
|
|
||||||
|
click_on 'Setting groups'
|
||||||
|
expect(page).to have_text('Domain validation')
|
||||||
|
click_on 'Edit settings'
|
||||||
|
expect(page).to have_text('Nameserver minimum count')
|
||||||
|
expect(page).to have_text('Nameserver maximum count')
|
||||||
|
|
||||||
|
val_min = find_field('Nameserver minimum count').value
|
||||||
|
val_max = find_field('Nameserver maximum count').value
|
||||||
|
|
||||||
|
expect(val_min).to eq('1')
|
||||||
|
expect(val_max).to eq('13')
|
||||||
|
|
||||||
|
fill_in('Nameserver minimum count', with: '3')
|
||||||
|
fill_in('Nameserver maximum count', with: '10')
|
||||||
|
|
||||||
|
click_on 'Save'
|
||||||
|
|
||||||
|
val_min = find_field('Nameserver minimum count').value
|
||||||
|
val_max = find_field('Nameserver maximum count').value
|
||||||
|
|
||||||
|
expect(val_min).to eq('3')
|
||||||
|
expect(val_max).to eq('10')
|
||||||
|
end
|
||||||
|
end
|
5
spec/models/setting_group_spec.rb
Normal file
5
spec/models/setting_group_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe SettingGroup do
|
||||||
|
it { should have_many(:settings) }
|
||||||
|
end
|
5
spec/models/setting_spec.rb
Normal file
5
spec/models/setting_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe Setting do
|
||||||
|
it { should belong_to(:setting_group) }
|
||||||
|
end
|
|
@ -4,6 +4,7 @@ require 'spec_helper'
|
||||||
require File.expand_path("../../config/environment", __FILE__)
|
require File.expand_path("../../config/environment", __FILE__)
|
||||||
require 'rspec/rails'
|
require 'rspec/rails'
|
||||||
require 'shoulda/matchers'
|
require 'shoulda/matchers'
|
||||||
|
require 'capybara/poltergeist'
|
||||||
|
|
||||||
# Requires supporting ruby files with custom matchers and macros, etc, in
|
# Requires supporting ruby files with custom matchers and macros, etc, in
|
||||||
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
||||||
|
@ -39,6 +40,10 @@ RSpec.configure do |config|
|
||||||
DatabaseCleaner.strategy = :truncation
|
DatabaseCleaner.strategy = :truncation
|
||||||
end
|
end
|
||||||
|
|
||||||
|
config.before(:each, js: true) do
|
||||||
|
DatabaseCleaner.strategy = :truncation
|
||||||
|
end
|
||||||
|
|
||||||
config.before(:each) do
|
config.before(:each) do
|
||||||
DatabaseCleaner.start
|
DatabaseCleaner.start
|
||||||
end
|
end
|
||||||
|
@ -47,6 +52,8 @@ RSpec.configure do |config|
|
||||||
DatabaseCleaner.clean
|
DatabaseCleaner.clean
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Capybara.javascript_driver = :poltergeist
|
||||||
|
|
||||||
# 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
|
||||||
# `post` in specs under `spec/controllers`.
|
# `post` in specs under `spec/controllers`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue