Sha256: 771a9b3227e8bd7b2616aa06b2116c96c14e9cfc56a19ef128561abd6f3e4728

Contents?: true

Size: 576 Bytes

Versions: 3

Compression:

Stored size: 576 Bytes

Contents

RSpec::Matchers.define :be_colored do |expected|

  def effects_string(actual)
    effects = applied_effects(actual).join(' and ')
    effects.length > 0 ? effects : "unformatted"
  end

  match do |actual|
    applied_effects(actual).include? expected.to_sym
  end

  failure_message_for_should do |actual|
    "expected that '#{strip(actual)}' would be colored #{expected}, but was #{effects_string(actual)}"
  end
  failure_message_for_should_not do |actual|
    "expected that #{strip(actual)} would not be colored #{expected}, but was #{effects_string(actual)}"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xcpretty-0.0.6 spec/support/matchers/colors.rb
xcpretty-0.0.5 spec/support/matchers/colors.rb
xcpretty-0.0.4 spec/support/matchers/colors.rb