testing simplecov and rcov stuff

This commit is contained in:
Devin Howard 2016-02-01 17:25:06 +08:00
parent d64fe002dc
commit e460899ea3
4 changed files with 16 additions and 5 deletions

View file

@ -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

View file

@ -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 ######

View file

@ -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

View file

@ -1,3 +1,4 @@
require 'simplecov'
require 'support/controller_helpers'
RSpec.configure do |config|