Sha256: 68fd85132aa6334d68ec3853c54ad4be861130eb58edc1fced46b2c6dfa16977

Contents?: true

Size: 630 Bytes

Versions: 10

Compression:

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

10 entries across 10 versions & 2 rubygems

Version Path
learn-xcpretty-0.1.12 spec/support/matchers/colors.rb
xcpretty-0.1.12 spec/support/matchers/colors.rb
xcpretty-0.1.11 spec/support/matchers/colors.rb
xcpretty-0.1.10 spec/support/matchers/colors.rb
learn-xcpretty-0.1.11 spec/support/matchers/colors.rb
xcpretty-0.1.9 spec/support/matchers/colors.rb
xcpretty-0.1.8 spec/support/matchers/colors.rb
xcpretty-0.1.7 spec/support/matchers/colors.rb
xcpretty-0.1.6 spec/support/matchers/colors.rb
xcpretty-0.1.5 spec/support/matchers/colors.rb