Sha256: 3ee82fcaa0c3468f474b49ab8c099c98a39e2855dc099b91072e9c5b3b10df57

Contents?: true

Size: 577 Bytes

Versions: 8

Compression:

Stored size: 577 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

8 entries across 8 versions & 1 rubygems

Version Path
xcpretty-0.1.4 spec/support/matchers/colors.rb
xcpretty-0.1.3 spec/support/matchers/colors.rb
xcpretty-0.1.2 spec/support/matchers/colors.rb
xcpretty-0.1.1 spec/support/matchers/colors.rb
xcpretty-0.1.0 spec/support/matchers/colors.rb
xcpretty-0.0.9 spec/support/matchers/colors.rb
xcpretty-0.0.8 spec/support/matchers/colors.rb
xcpretty-0.0.7 spec/support/matchers/colors.rb