Sha256: 84343ecee4053e5f25832b8e6727b1fa73a47897fe63d030cb6885261960b9ea

Contents?: true

Size: 1.49 KB

Versions: 41

Compression:

Stored size: 1.49 KB

Contents

require 'pathname'
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
$LOAD_PATH.unshift((ROOT + 'lib').to_s)
$LOAD_PATH.unshift((ROOT + 'spec').to_s)

require 'bundler/setup'
require 'pry'

require 'rspec'
require 'danger'

# Use coloured output, it's the best.
RSpec.configure do |config|
  config.filter_gems_from_backtrace 'bundler'
  config.color = true
  config.tty = true
end

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,
# it comes with an extra function `.string` which will
# strip all ANSI colours from the string.

# rubocop:disable Lint/NestedMethodDefinition
def testing_ui
  @output = StringIO.new
  def @output.winsize
    [20, 9999]
  end

  cork = Cork::Board.new(out: @output)
  def cork.string
    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'
  }
end

# A stubbed out Dangerfile for use in tests
def testing_dangerfile
  env = Danger::EnvironmentManager.new(testing_env)
  Danger::Dangerfile.new(env, testing_ui)
end

Version data entries

41 entries across 41 versions & 14 rubygems

Version Path
danger-jacoco-0.1.4 spec/spec_helper.rb
danger-jacoco-0.1.3 spec/spec_helper.rb
danger-eslint-0.1.3 spec/spec_helper.rb
danger-eslint-0.1.2 spec/spec_helper.rb
danger-jacoco-0.1.2 spec/spec_helper.rb
danger-jacoco-0.1.1 spec/spec_helper.rb
danger-jacoco-0.1.0 spec/spec_helper.rb
danger-hlint-0.0.5 spec/spec_helper.rb
danger-hlint-0.0.4 spec/spec_helper.rb
danger-jacoco-0.0.3 spec/spec_helper.rb
danger-hlint-0.0.3 spec/spec_helper.rb
danger-mention-0.6.1 spec/spec_helper.rb
danger-eslint-0.1.1 spec/spec_helper.rb
danger-eslint-0.1.0 spec/spec_helper.rb
danger-angular_commit_lint-1.1.2 spec/spec_helper.rb
danger-commit_lint-0.0.6 spec/spec_helper.rb
danger-xcprofiler-0.1.0 spec/spec_helper.rb
danger-linear_history-0.0.2 spec/spec_helper.rb
danger-linear_history-0.0.1 spec/spec_helper.rb
danger-lgtm-0.1.1 spec/spec_helper.rb