diff --git a/Gemfile b/Gemfile index 7554cf5c0..d7d6dab61 100644 --- a/Gemfile +++ b/Gemfile @@ -118,4 +118,7 @@ group :development, :test do # For unique IDs (used by the epp gem) gem 'uuidtools', '~> 2.1.4' + + # For code review + gem 'simplecov', '~> 0.9.1', :require => false end diff --git a/Gemfile.lock b/Gemfile.lock index 36d4a25cb..0b8cf0bc6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -61,6 +61,7 @@ GEM thread_safe (~> 0.1) warden (~> 1.2.3) diff-lcs (1.2.5) + docile (1.1.5) epp (1.4.0) hpricot libxml-ruby @@ -219,6 +220,11 @@ GEM rdoc (~> 4.0) shoulda-matchers (2.6.2) activesupport (>= 3.0.0) + simplecov (0.9.1) + docile (~> 1.1.0) + multi_json (~> 1.0) + simplecov-html (~> 0.8.0) + simplecov-html (0.8.0) simpleidn (0.0.5) slop (3.6.0) spring (1.1.3) @@ -297,6 +303,7 @@ DEPENDENCIES sass-rails (~> 4.0.3) sdoc (~> 0.4.0) shoulda-matchers (~> 2.6.1) + simplecov (~> 0.9.1) simpleidn (~> 0.0.5) spring therubyracer diff --git a/app/views/client/contacts/show.haml b/app/views/client/contacts/show.haml index 887d8ea93..80fcccccf 100644 --- a/app/views/client/contacts/show.haml +++ b/app/views/client/contacts/show.haml @@ -13,3 +13,7 @@ .col-md-6= render 'admin/contacts/partials/address' .row .col-md-12= render 'client/contacts/partials/domains' + +- if @contact.versions.present? + = render 'client/shared/versions', versions: @contact.versions + diff --git a/app/views/client/domains/show.haml b/app/views/client/domains/show.haml index 7b895c94f..c8c59f303 100644 --- a/app/views/client/domains/show.haml +++ b/app/views/client/domains/show.haml @@ -21,3 +21,7 @@ .col-md-12= render 'admin/domains/partials/nameservers' .row .col-md-12= render 'admin/domains/partials/dnskeys' + +- if @domain.versions.present? + = render 'client/shared/versions', versions: @domain.versions + diff --git a/app/views/client/shared/_versions.haml b/app/views/client/shared/_versions.haml new file mode 100644 index 000000000..3f9a95305 --- /dev/null +++ b/app/views/client/shared/_versions.haml @@ -0,0 +1,24 @@ +.row + .col-md-12 + #nameservers.panel{ class: 'panel-default' } + .panel-heading.clearfix + = t('shared.history') + .table-responsive + %table.table.table-hover.table-bordered.table-condensed + %thead + %tr + %th + =t('shared.whodunnit') + %th + =t('shared.event') + %th + =t('shared.created_at') + + %tbody + -versions.each do |version| + %tr + %td= whodunnit_with_protocol(version.whodunnit) + %td= version.event + %td= version.created_at + + diff --git a/bin/robot b/bin/robot index 195a6b3dd..9232e247f 100755 --- a/bin/robot +++ b/bin/robot @@ -1,19 +1,25 @@ -#!/bin/bash -e - +#!/bin/bash # # Build and run everything for automatic tests # +set -o pipefail -# cd to current script directory -cd "$(dirname "$0")" +# cd to Rails root directory +cd "$(dirname "$0")"; cd .. git pull origin master -bundle install --deployment +git reset --hard +unset GIT_DIR GIT_WORK_TREE + +setuser app bundle install --deployment # cp config/secrets-example.yml config/secrets.yml # create manually config/database.yml -RAILS_ENV=test bundle exec rake db:reset +RAILS_ENV=test bundle exec rake db:drop +RAILS_ENV=test bundle exec rake db:create +RAILS_ENV=test bundle exec rake db:schema:load +RAILS_ENV=test bundle exec rake db:seed RAILS_ENV=test bundle exec rake assets:precompile echo "GIT_LAST_COMMITS" @@ -27,6 +33,5 @@ echo "END_OF_RUBOCOP_RESULTS" # run tests echo "TEST_RESULTS" -RAILS_ENV=test bundle exec rake test:other +RAILS_ENV=test ROBOT=true bundle exec rake test echo "END_OF_TEST_RESULTS" - diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 6a878e510..338fa88d6 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -6,6 +6,11 @@ require 'rspec/rails' require 'shoulda/matchers' require 'capybara/poltergeist' +if ENV['ROBOT'] + require 'simplecov' + SimpleCov.start 'rails' +end + # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are # run as spec files by default. This means that files in spec/support that end