Sha256: bd573b4384b8f73a7b77ac76015d314536253e6cd4394f3b27fc8bf1248267fe

Contents?: true

Size: 700 Bytes

Versions: 5

Compression:

Stored size: 700 Bytes

Contents

# Verifies that a posable object has the given pose words in its search index.
RSpec::Matchers.define :have_pose_words do |expected|

  match do |actual|
    actual.should have(expected.size).pose_words
    texts = actual.pose_words.map &:text
    expected.each do |expected_word|
      # Note (KG): Can't use text.should include(expected_word) here
      #            because Ruby thinks I want to include a Module for some reason.
      texts.include?(expected_word).should be_true
    end
  end

  failure_message_for_should do |actual|
    texts = actual.pose_words.map &:text
    "expected that subject would have pose words [#{expected.join ', '}], but it has [#{texts.join ', '}]"
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pose-1.2.5 spec/support/matchers.rb
pose-1.2.4 spec/support/matchers.rb
pose-1.2.3 spec/support/matchers.rb
pose-1.2.2 spec/support/matchers.rb
pose-1.2.1 spec/support/matchers.rb