From e460899ea34a710c8dea5f82dcde5b5a9f8dcd47 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Mon, 1 Feb 2016 17:25:06 +0800 Subject: [PATCH] testing simplecov and rcov stuff --- .simplecov | 10 +++++++--- app/models/synapse.rb | 6 ++++++ bin/jenkins-test.sh | 4 ++-- spec/spec_helper.rb | 1 + 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.simplecov b/.simplecov index 678db531..deb2c46e 100644 --- a/.simplecov +++ b/.simplecov @@ -1,3 +1,7 @@ -require 'simplecov-rcov' -SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter -SimpleCov.start 'rails' +if ENV['COVERAGE_FORMATTER'] == 'rcov' + require 'simplecov-rcov' + SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter +end +if ENV['COVERAGE'] == 'on' + SimpleCov.start 'rails' +end diff --git a/app/models/synapse.rb b/app/models/synapse.rb index 225485e5..0b40da02 100644 --- a/app/models/synapse.rb +++ b/app/models/synapse.rb @@ -13,17 +13,23 @@ class Synapse < ActiveRecord::Base validates :permission, presence: true validates :permission, inclusion: { in: Perm::ISSIONS.map(&:to_s) } + # :nocov: def user_name self.user.name end + # :nocov: + # :nocov: def user_image self.user.image.url end + # :nocov: + # :nocov: def as_json(options={}) super(:methods =>[:user_name, :user_image]) end + # :nocov: ##### PERMISSIONS ###### diff --git a/bin/jenkins-test.sh b/bin/jenkins-test.sh index 313c23b3..511899c7 100755 --- a/bin/jenkins-test.sh +++ b/bin/jenkins-test.sh @@ -1,6 +1,6 @@ #!/bin/bash -l -#prerequisites +# jenkins machine prerequisites #sudo aptitude -q -y install libpq-dev source "$HOME/.rvm/scripts/rvm" @@ -21,4 +21,4 @@ sed -i -e "s/DB_USERNAME='.*'/DB_USERNAME='jenkins'/" .env #test bundle install rake db:create db:test:prepare -bundle exec rspec +COVERAGE=on COVERAGE_FORMATTER=rcov bundle exec rspec diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 842badd5..08ffd17f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,4 @@ +require 'simplecov' require 'support/controller_helpers' RSpec.configure do |config|