Sha256: 1ec386123d144f03c6f462285f297e3cb9b1f07fcd3a41764f0db77440bf39be

Contents?: true

Size: 631 Bytes

Versions: 26

Compression:

Stored size: 631 Bytes

Contents

require 'rspec' unless Object.const_defined? :RSpec

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

26 entries across 26 versions & 3 rubygems

Version Path
xcpretty-0.4.0 spec/support/matchers/colors.rb
xcpretty-security-patched-0.3.2 spec/support/matchers/colors.rb
xcpretty-security-patched-0.3.0 spec/support/matchers/colors.rb
xcpretty-0.3.0 spec/support/matchers/colors.rb
xcpretty-0.2.8 spec/support/matchers/colors.rb
xcpretty-0.2.7 spec/support/matchers/colors.rb
xcpretty-0.2.6 spec/support/matchers/colors.rb
xcpretty-0.2.4 spec/support/matchers/colors.rb
xcpretty-0.2.3 spec/support/matchers/colors.rb
xcpretty-bb-0.1.12.bb14 spec/support/matchers/colors.rb
xcpretty-bb-0.1.12.bb13 spec/support/matchers/colors.rb
xcpretty-bb-0.1.12.bb12 spec/support/matchers/colors.rb
xcpretty-bb-0.1.12.bb11 spec/support/matchers/colors.rb
xcpretty-bb-0.1.12.bb10 spec/support/matchers/colors.rb
xcpretty-bb-0.1.12.bb9 spec/support/matchers/colors.rb
xcpretty-bb-0.1.12.bb8 spec/support/matchers/colors.rb
xcpretty-0.2.2 spec/support/matchers/colors.rb
xcpretty-bb-0.1.12.bb7 spec/support/matchers/colors.rb
xcpretty-0.2.1 spec/support/matchers/colors.rb
xcpretty-bb-0.1.12.bb6 spec/support/matchers/colors.rb