RSpec::Matchers.define :be_an_array_of do |klass|
  match do |actual|
    actual.class == Array &&
      actual.all? {|item| item.class == klass}
  end
end

RSpec::Matchers.define :have_size do |length|
  match { |actual| actual.length == length }
  failure_message do |actual|
    "expected #{actual} to have size #{expected} but have #{actual.length}"
  end
end