From e27cda13909eb15a58e682c1d1782ba85430313c Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Wed, 18 Feb 2015 18:06:11 +0200 Subject: [PATCH 1/7] refactor legal document attrs --- app/models/epp/contact.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 276b490d6..0a6c14020 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -5,9 +5,6 @@ class Epp::Contact < Contact # disable STI, there is type column present self.inheritance_column = :sti_disabled - # temp fix - has_many :legal_documents, as: :documentable - class << self # rubocop: disable Metrics/PerceivedComplexity # rubocop: disable Metrics/CyclomaticComplexity @@ -54,11 +51,10 @@ class Epp::Contact < Contact end def legal_document_attrs(legal_frame) - attrs = {}.with_indifferent_access - attrs[0] = {}.with_indifferent_access - attrs[0][:body] = legal_frame.text - attrs[0][:document_type] = legal_frame['type'] - attrs + [{ + body: legal_frame.text, + document_type: legal_frame['type'] + }] end end From fd500f4ee108c95ae552b2139a6e474d2ef46a30 Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Fri, 20 Feb 2015 17:43:20 +0200 Subject: [PATCH 2/7] Added alpha travis setup --- .travis.yml | 15 +++++++++++++++ Gemfile | 3 +++ Gemfile.lock | 1 + lib/tasks/test.rake | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..9169f9af9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +language: ruby +rvm: + - 2.2 + - ruby-head + +sudo: false +script: 'ci/travis.rb' +before_install: + - gem install bundler + - "rm ${BUNDLE_GEMFILE}.lock" +before_script: + - bundle update +cache: bundler +addons: + postgresql: "9.3" diff --git a/Gemfile b/Gemfile index c901c0e56..b9360ace8 100644 --- a/Gemfile +++ b/Gemfile @@ -110,4 +110,7 @@ group :development, :test do # dev tools gem 'unicorn' + + # for travis + gem 'rake' end diff --git a/Gemfile.lock b/Gemfile.lock index 9097efcef..eb77b8396 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -478,6 +478,7 @@ DEPENDENCIES railroady (~> 1.3.0) rails (= 4.2.0) rails-settings-cached (~> 0.4.1) + rake ransack (~> 1.5.1) rspec-rails (~> 3.0.2) rubocop (~> 0.26.1) diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake index 20e3f5f91..ac5b5159d 100644 --- a/lib/tasks/test.rake +++ b/lib/tasks/test.rake @@ -30,7 +30,7 @@ begin end Rake::Task[:default].prerequisites.clear - task default: :test + task default: 'test:other' def test_against_server _stdin, _stdout, _stderr, wait_thr = Open3.popen3('unicorn -E test -p 8989') From 76af6a8182469aa70009c6e16d46c99baff8d124 Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Fri, 20 Feb 2015 18:19:11 +0200 Subject: [PATCH 3/7] Added travis database yml --- .travis.yml | 9 +++++++-- config/database-travis.yml | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 config/database-travis.yml diff --git a/.travis.yml b/.travis.yml index 9169f9af9..22d8154dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,14 +2,19 @@ language: ruby rvm: - 2.2 - ruby-head - +env: + - DB=postgresql sudo: false -script: 'ci/travis.rb' before_install: - gem install bundler - "rm ${BUNDLE_GEMFILE}.lock" before_script: - bundle update + - cp config/application-example.yml config/application.yml + - cp config/database-travis.yml config/database.yml + - RAILS_ENV=test bundle exec rake db:all:setup +script: + - RAILS_ENV=test bundle exec rake cache: bundler addons: postgresql: "9.3" diff --git a/config/database-travis.yml b/config/database-travis.yml new file mode 100644 index 000000000..bf0765265 --- /dev/null +++ b/config/database-travis.yml @@ -0,0 +1,19 @@ +default: &default + host: localhost + adapter: postgresql + encoding: unicode + pool: 5 + username: postgres + password: + +test: + <<: *default + database: registry_test + +whois_test: + <<: *default + database: registry_whois_test + +api_log_test: + <<: *default + database: registry_api_log_test From 9e92cced85608b0f085984cd9297d827a45d85fc Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Fri, 20 Feb 2015 18:51:22 +0200 Subject: [PATCH 4/7] Updated travis postgres setup --- .travis.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 22d8154dc..9308b354d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,12 +9,18 @@ before_install: - gem install bundler - "rm ${BUNDLE_GEMFILE}.lock" before_script: + - psql -c 'create database registry_test;' -U postgres + - psql -c 'create database registry_whois_test;' -U postgres + - psql -c 'create database registry_api_log_test;' -U postgres - bundle update - cp config/application-example.yml config/application.yml - cp config/database-travis.yml config/database.yml - - RAILS_ENV=test bundle exec rake db:all:setup + - RAILS_ENV=test bundle exec rake db:all:schema:load + - RAILS_ENV=test bundle exec rake db:seed script: - RAILS_ENV=test bundle exec rake cache: bundler +services: + - postgresql addons: postgresql: "9.3" From 09b2cfbc13572250e4fdb480eb57da6534c4ddfc Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Fri, 20 Feb 2015 19:05:23 +0200 Subject: [PATCH 5/7] Removed deprication warning about establish connection --- lib/tasks/db.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index 3108ad02f..73f217711 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -41,7 +41,7 @@ namespace :db do databases.each do |name| begin puts "\n---------------------------- #{name} ----------------------------------------\n" - ActiveRecord::Base.establish_connection(name) + ActiveRecord::Base.establish_connection(name.to_sym) if ActiveRecord::Base.connection.table_exists?('schema_migrations') puts 'Found tables, skip schema load!' else From 1febb242ef43d959f2875dcc3b4924bcee24c2a8 Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Fri, 20 Feb 2015 19:08:05 +0200 Subject: [PATCH 6/7] Added secrets to travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9308b354d..5fc709227 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ before_script: - psql -c 'create database registry_api_log_test;' -U postgres - bundle update - cp config/application-example.yml config/application.yml + - cp config/secrets-example.yml config/secrets.yml - cp config/database-travis.yml config/database.yml - RAILS_ENV=test bundle exec rake db:all:schema:load - RAILS_ENV=test bundle exec rake db:seed From 15c296fd362e26bcccafbd346629271b2ff67e8c Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Fri, 20 Feb 2015 19:21:57 +0200 Subject: [PATCH 7/7] Added travis badge --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 2733fd2bd..8b1dabe6d 100644 --- a/README.md +++ b/README.md @@ -359,3 +359,8 @@ This needs a static greeting file, so you will have to make /var/www writable. mkdir epp Copy the files from $mod_epp/examples/cgis to /usr/lib/cgi-bin/epp + +## Code Status + +Alpha release status, only model tests: +[![Build Status](https://travis-ci.org/domify/registry.svg?branch=master)](https://travis-ci.org/domify/registry)