Sha256: 92a050081e385b5feb3649e27934d8cd5f397a90194f2afae29a7fda49516bda

Contents?: true

Size: 740 Bytes

Versions: 198

Compression:

Stored size: 740 Bytes

Contents

RSpec::Matchers.define :have_colorized_text do |color, text|
  match do |actual|
    color_codes = Appsignal::CLI::Helpers::COLOR_CODES
    reset_color_code = color_codes.fetch(:default)
    color_code = color_codes.fetch(color)

    @expected = "\e[#{color_code}m#{text}\e[#{reset_color_code}m"
    expect(actual).to include(@expected)
  end

  diffable
  attr_reader :expected
end

COLOR_TAG_MATCHER_REGEX = /\e\[(\d+)m/
RSpec::Matchers.define :have_color_markers do
  match do |actual|
    actual =~ COLOR_TAG_MATCHER_REGEX
  end

  failure_message do
    "expected that output contains color markers: /\\e[\\d+m/"
  end

  failure_message_when_negated do
    "expected that output does not contain color markers: /\\e[\\d+m/"
  end
end

Version data entries

198 entries across 198 versions & 1 rubygems

Version Path
appsignal-3.3.11-java spec/support/matchers/have_colorized_text.rb
appsignal-3.3.11 spec/support/matchers/have_colorized_text.rb
appsignal-3.4.10-java spec/support/matchers/have_colorized_text.rb
appsignal-3.4.10 spec/support/matchers/have_colorized_text.rb
appsignal-3.4.9-java spec/support/matchers/have_colorized_text.rb
appsignal-3.4.9 spec/support/matchers/have_colorized_text.rb
appsignal-3.4.8-java spec/support/matchers/have_colorized_text.rb
appsignal-3.4.8 spec/support/matchers/have_colorized_text.rb
appsignal-3.4.7-java spec/support/matchers/have_colorized_text.rb
appsignal-3.4.7 spec/support/matchers/have_colorized_text.rb
appsignal-3.4.6-java spec/support/matchers/have_colorized_text.rb
appsignal-3.4.6 spec/support/matchers/have_colorized_text.rb
appsignal-3.4.5-java spec/support/matchers/have_colorized_text.rb
appsignal-3.4.5 spec/support/matchers/have_colorized_text.rb
appsignal-3.4.4-java spec/support/matchers/have_colorized_text.rb
appsignal-3.4.4 spec/support/matchers/have_colorized_text.rb
appsignal-3.4.3-java spec/support/matchers/have_colorized_text.rb
appsignal-3.4.3 spec/support/matchers/have_colorized_text.rb
appsignal-3.4.2-java spec/support/matchers/have_colorized_text.rb
appsignal-3.4.2 spec/support/matchers/have_colorized_text.rb