Class: ChatNotifier::TestEnvironment

Inherits:
Object
  • Object
show all
Defined in:
lib/chat_notifier/test_environment.rb,
lib/chat_notifier/test_environment/debug.rb,
lib/chat_notifier/test_environment/github.rb

Overview

All information about the place where the test was run

Direct Known Subclasses

Debug, Github

Defined Under Namespace

Classes: Debug, Github

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings:) ⇒ TestEnvironment

Returns a new instance of TestEnvironment.



6
7
8
# File 'lib/chat_notifier/test_environment.rb', line 6

def initialize(settings:)
  @settings = settings
end

Instance Attribute Details

#settingsObject (readonly)

Returns the value of attribute settings.



10
11
12
# File 'lib/chat_notifier/test_environment.rb', line 10

def settings
  @settings
end

Class Method Details

.for(settings) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/chat_notifier/test_environment.rb', line 12

def self.for(settings)
  if settings["DEBUG"]
    Debug
  else
    Github
  end.new(settings: settings)
end

Instance Method Details

#job_identifierObject



31
32
33
34
35
36
# File 'lib/chat_notifier/test_environment.rb', line 31

def job_identifier
  settings.fetch("NOTIFY_JOB_NAME") do
    job = settings.fetch("GITHUB_JOB", "test")
    "#{job} ruby-#{RUBY_VERSION}"
  end
end

#pull_request_refObject



45
46
# File 'lib/chat_notifier/test_environment.rb', line 45

def pull_request_ref
end

#ruby_versionObject



20
21
22
# File 'lib/chat_notifier/test_environment.rb', line 20

def ruby_version
  "Ruby #{::RUBY_VERSION}"
end

#run_idObject



38
39
# File 'lib/chat_notifier/test_environment.rb', line 38

def run_id
end

#run_keyObject

Key used to group status reports by run in the parent digest. Distinct from run_id (which URLs need bare) so re-runs can sort as newer runs.



43
# File 'lib/chat_notifier/test_environment.rb', line 43

def run_key = run_id

#test_run_urlObject



28
29
# File 'lib/chat_notifier/test_environment.rb', line 28

def test_run_url
end

#urlObject



24
25
26
# File 'lib/chat_notifier/test_environment.rb', line 24

def url
  settings.fetch("NOTIFY_CURRENT_REPOSITORY_URL")
end