Sha256: 44d5c4af7940ad3bcafc2a96455c91205e7940be9afffc7d19b36925d49e3895

Contents?: true

Size: 679 Bytes

Versions: 51

Compression:

Stored size: 679 Bytes

Contents

require 'rspec/matchers'
RSpec::Matchers.define :have_categories do |*expected|

  match do |results|
    extract_categories(actual) == expected
  end

  failure_message_for_should do |results|
    "expected categories #{extract_categories(results)} to be named and ordered as #{expected}"
  end

  failure_message_for_should_not do |results|
    "expected categories #{extract_categories(results)} not to be named and ordered as #{expected}"
  end

  description do
    "be categories named and ordered as #{expected}"
  end

  def extract_categories results
    results.allocations.map do |allocation|
      allocation[3].map { |combination| combination[0] }
    end
  end

end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
picky-client-4.19.4 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.19.3 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.19.2 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.19.1 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.19.0 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.18.0 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.17.1 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.17.0 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.16.0 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.15.1 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.15.0 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.14.0 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.13.1 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.13.0 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.12.13 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.12.12 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.12.11 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.12.10 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.12.8 lib/picky-client/spec/support/matchers/have_categories.rb
picky-client-4.12.7 lib/picky-client/spec/support/matchers/have_categories.rb