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.1.2-java spec/support/matchers/have_colorized_text.rb
appsignal-3.1.2 spec/support/matchers/have_colorized_text.rb
appsignal-3.1.1-java spec/support/matchers/have_colorized_text.rb
appsignal-3.1.1 spec/support/matchers/have_colorized_text.rb
appsignal-3.1.0-java spec/support/matchers/have_colorized_text.rb
appsignal-3.1.0 spec/support/matchers/have_colorized_text.rb
appsignal-3.0.27-java spec/support/matchers/have_colorized_text.rb
appsignal-3.0.27 spec/support/matchers/have_colorized_text.rb
appsignal-3.0.26-java spec/support/matchers/have_colorized_text.rb
appsignal-3.0.26 spec/support/matchers/have_colorized_text.rb
appsignal-3.0.25-java spec/support/matchers/have_colorized_text.rb
appsignal-3.0.25 spec/support/matchers/have_colorized_text.rb
appsignal-3.0.24-java spec/support/matchers/have_colorized_text.rb
appsignal-3.0.24 spec/support/matchers/have_colorized_text.rb
appsignal-3.0.23-java spec/support/matchers/have_colorized_text.rb
appsignal-3.0.23 spec/support/matchers/have_colorized_text.rb
appsignal-3.0.22-java spec/support/matchers/have_colorized_text.rb
appsignal-3.0.22 spec/support/matchers/have_colorized_text.rb
appsignal-3.0.21-java spec/support/matchers/have_colorized_text.rb
appsignal-3.0.21 spec/support/matchers/have_colorized_text.rb