Sha256: f795f633b87bfbe451473667d658524741793a4a9ab0a68ea0e383d2f98d4f5d

Contents?: true

Size: 467 Bytes

Versions: 16

Compression:

Stored size: 467 Bytes

Contents

class BeASubsetOfMatcher
  attr_reader :subset, :set

  def initialize(set)
    @set = set
  end

  def matches?(subset)
    @subset = subset
    (subset - set).empty?
  end

  def description
    "be a subset"
  end

  def failure_message_for_should
    "Expected to be a subset.\nSubset: #{subset.inspect}\nSet: #{set.inspect}"
  end

  def failure_message_for_should_not
    "Expected not to be a subset.\nSubset: #{subset.inspect}\nSet: #{set.inspect}"
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rr-3.1.1 spec/support/matchers/be_a_subset_of_matcher.rb
rr-3.1.0 spec/support/matchers/be_a_subset_of_matcher.rb
rr-3.0.9 spec/support/matchers/be_a_subset_of_matcher.rb
rr-3.0.8 spec/support/matchers/be_a_subset_of_matcher.rb
rr-3.0.7 spec/support/matchers/be_a_subset_of_matcher.rb
rr-3.0.6 spec/support/matchers/be_a_subset_of_matcher.rb
rr-3.0.5 spec/support/matchers/be_a_subset_of_matcher.rb
rr-3.0.4 spec/support/matchers/be_a_subset_of_matcher.rb
rr-3.0.3 spec/support/matchers/be_a_subset_of_matcher.rb
rr-3.0.2 spec/support/matchers/be_a_subset_of_matcher.rb
rr-3.0.1 spec/support/matchers/be_a_subset_of_matcher.rb
rr-3.0.0 spec/support/matchers/be_a_subset_of_matcher.rb
rr-1.2.1 spec/support/matchers/be_a_subset_of_matcher.rb
rr-1.2.0 spec/support/matchers/be_a_subset_of_matcher.rb
rr-1.1.2 spec/support/matchers/be_a_subset_of_matcher.rb
rr-1.1.2.rc1 spec/support/matchers/be_a_subset_of_matcher.rb