spec/spec_helper.rb in danger-rcov-1.0.1 vs spec/spec_helper.rb in danger-rcov-1.0.2
- old
+ new
@@ -1,29 +1,44 @@
-require "pathname"
-ROOT = Pathname.new(File.expand_path("../../", __FILE__))
-$:.unshift((ROOT + "lib").to_s)
-$:.unshift((ROOT + "spec").to_s)
+# frozen_string_literal: true
-require "bundler/setup"
+require 'pathname'
+ROOT = Pathname.new(File.expand_path('..', __dir__))
+$:.unshift((ROOT + 'lib').to_s)
+$:.unshift((ROOT + 'spec').to_s)
-require "rspec"
-require "danger"
+require 'bundler/setup'
+require 'rspec'
+require 'danger'
+
+require 'simplecov'
+require 'simplecov-json'
+
+SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
+ [
+ SimpleCov::Formatter::HTMLFormatter,
+ SimpleCov::Formatter::JSONFormatter
+ ]
+)
+SimpleCov.start do
+ add_filter 'spec'
+end
+
if `git remote -v` == ''
- puts "You cannot run tests without setting a local git remote on this repo"
+ puts 'You cannot run tests without setting a local git remote on this repo'
puts "It's a weird side-effect of Danger's internals."
exit(0)
end
# Use coloured output, it's the best.
RSpec.configure do |config|
- config.filter_gems_from_backtrace "bundler"
+ config.filter_gems_from_backtrace 'bundler'
config.color = true
config.tty = true
end
-require "danger_plugin"
+require 'danger_plugin'
# These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
# If you are expanding these files, see if it's already been done ^.
# A silent version of the user interface,
@@ -37,24 +52,24 @@
[20, 9999]
end
cork = Cork::Board.new(out: @output)
def cork.string
- out.string.gsub(/\e\[([;\d]+)?m/, "")
+ out.string.gsub(/\e\[([;\d]+)?m/, '')
end
cork
end
# rubocop:enable Lint/NestedMethodDefinition
# Example environment (ENV) that would come from
# running a PR on TravisCI
def testing_env
{
- "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true",
- "TRAVIS_PULL_REQUEST" => "800",
- "TRAVIS_REPO_SLUG" => "artsy/eigen",
- "TRAVIS_COMMIT_RANGE" => "759adcbd0d8f...13c4dc8bb61d",
- "DANGER_GITHUB_API_TOKEN" => "123sbdq54erfsd3422gdfio"
+ 'HAS_JOSH_K_SEAL_OF_APPROVAL' => 'true',
+ 'TRAVIS_PULL_REQUEST' => '800',
+ 'TRAVIS_REPO_SLUG' => 'artsy/eigen',
+ 'TRAVIS_COMMIT_RANGE' => '759adcbd0d8f...13c4dc8bb61d',
+ 'DANGER_GITHUB_API_TOKEN' => '123sbdq54erfsd3422gdfio'
}
end
# A stubbed out Dangerfile for use in tests
def testing_dangerfile