Sha256: ab128794f11a303fb1f5e23a1742dec4a6ea3735cf4cce78f734d7a18178a511

Contents?: true

Size: 795 Bytes

Versions: 8

Compression:

Stored size: 795 Bytes

Contents

require 'rspec/matchers'

RSpec::Matchers.define :have_command_like do |regex|
  match do |command_list|
    @found = command_list.find{|c| c =~ regex }
    !!@found
  end

  failure_message_for_should do |command_list|
    "Didn't find a command matching #{regex} in commands:\n\n" + command_list.join("\n\n")
  end

  failure_message_for_should_not do |command_list|
    "Found unwanted command:\n\n#{@found}\n\n(matches regex #{regex})"
  end
end

RSpec::Matchers.define :have_app_code do
  match { |instance| instance.has_app_code? }

  failure_message_for_should do |instance|
    "Expected #has_app_code? to be true on instance: #{instance.inspect}"
  end

  failure_message_for_should_not do |instance|
    "Expected #has_app_code? to be false on instance: #{instance.inspect}"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
engineyard-2.0.0 spec/support/matchers.rb
engineyard-2.0.0.rc1 spec/support/matchers.rb
engineyard-2.0.0.pre5.1 spec/support/matchers.rb
engineyard-2.0.0.pre4 spec/support/matchers.rb
engineyard-2.0.0.pre3 spec/support/matchers.rb
engineyard-2.0.0.pre2 spec/support/matchers.rb
engineyard-2.0.0.pre1 spec/support/matchers.rb
engineyard-1.7.0.pre2 spec/support/matchers.rb