spec/spec_helper.rb in rake-funnel-0.3.2.pre vs spec/spec_helper.rb in rake-funnel-0.4.0.pre

- old
+ new

@@ -1,33 +1,43 @@ -require 'simplecov' -require 'coveralls' -require 'codeclimate-test-reporter' -require 'bundler/setup' - -SimpleCov.start do - if Coveralls.will_run? - external_services = [ - Coveralls::SimpleCov::Formatter, - CodeClimate::TestReporter::Formatter - ] - end - - formatter SimpleCov::Formatter::MultiFormatter[ - SimpleCov::Formatter::HTMLFormatter, - *external_services - ] - - coverage_dir('build/coverage') -end - -require 'rspec/its' -require 'rspec/collection_matchers' -require 'rake/funnel' - -# When invoked via the rspec rake task, output needs to by synced. -Rake::Funnel::Integration::SyncOutput.new - -RSpec.configure do |config| - config.expect_with :rspec do |c| - c.syntax = :expect - end -end +require 'rspec/its' +require 'rspec/collection_matchers' +require 'rake/funnel' +require 'simplecov' +require 'coveralls' +require 'codeclimate-test-reporter' +require 'bundler/setup' +require 'simplecov-teamcity-summary' + +SimpleCov.start do + if Coveralls.will_run? + external_services = [ + Coveralls::SimpleCov::Formatter, + CodeClimate::TestReporter::Formatter + ] + end + + formatter SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + *external_services + ] + + coverage_dir('build/coverage') + + at_exit do + result = SimpleCov.result + result.format! + + next unless Rake::Funnel::Integration::TeamCity.running? + + SimpleCov::Formatter::TeamcitySummaryFormatter.new.format(result) + Rake::Funnel::Integration::TeamCity::ServiceMessages.build_status(text: "{build.status.text}, Code Coverage #{result.covered_percent.round(2)}%") + end +end + +# When invoked via the rspec rake task, output needs to by synced. +Rake::Funnel::Integration::SyncOutput.new + +RSpec.configure do |config| + config.expect_with :rspec do |c| + c.syntax = :expect + end +end