Module: NoShitInMyGreenDots

Defined in:
lib/no_shit_in_my_green_dots.rb,
lib/no_shit_in_my_green_dots/rspec.rb,
lib/no_shit_in_my_green_dots/version.rb,
lib/no_shit_in_my_green_dots/minitest.rb

Defined Under Namespace

Modules: Integrations Classes: Error

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.enable!(framework = nil) ⇒ Object



9
10
11
12
13
14
# File 'lib/no_shit_in_my_green_dots.rb', line 9

def enable!(framework = nil)
  @enabled ||= {}

  frameworks = framework ? [framework] : [:rspec, :minitest]
  frameworks.each { |fw| install_framework(fw) }
end

.enabled?(framework = nil) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
# File 'lib/no_shit_in_my_green_dots.rb', line 16

def enabled?(framework = nil)
  return false unless defined?(@enabled)
  return @enabled.values.any? if framework.nil?

  !!@enabled[framework]
end

.leak_message(output) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/no_shit_in_my_green_dots.rb', line 23

def leak_message(output)
  return "Test wrote to STDOUT (no content captured)." if output.nil? || output.empty?

  trimmed = output.dup
  trimmed = trimmed[0, 720] + "...(truncated)" if trimmed.length > 720
  <<~MSG
    Test wrote to STDOUT:
    ---
    #{trimmed}
    ---
  MSG
end