Sha256: 4dab9be643f26c698e341b5dc66dcaa6eee152f2e1260a18962d3716147f6947

Contents?: true

Size: 414 Bytes

Versions: 20

Compression:

Stored size: 414 Bytes

Contents

class PhraseMatcher
  def initialize(string)
    @string = string
    @pattern = /\b#{Regexp.escape string}\b/
  end

  def matches?(actual)
    @actual = actual.to_s
    @actual =~ @pattern
  end

  def failure_message
    "expected #{@actual.inspect} to contain phrase #{@string.inspect}"
  end

  def negative_failure_message
    "expected #{@actual.inspect} not to contain phrase #{@string.inspect}"
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
will_paginate-3.3.1 spec/matchers/phrase_matcher.rb
will_paginate-3.3.0 spec/matchers/phrase_matcher.rb
will_paginate-3.2.1 spec/matchers/phrase_matcher.rb
will_paginate-3.2.0 spec/matchers/phrase_matcher.rb
will_paginate-3.1.8 spec/matchers/phrase_matcher.rb
will_paginate-3.1.7 spec/matchers/phrase_matcher.rb
will_paginate-3.1.6 spec/matchers/phrase_matcher.rb
will_paginate-3.0.12 spec/matchers/phrase_matcher.rb
will_paginate-3.1.5 spec/matchers/phrase_matcher.rb
will_paginate-3.0.11 spec/matchers/phrase_matcher.rb
will_paginate-3.1.3 spec/matchers/phrase_matcher.rb
will_paginate-3.0.10 spec/matchers/phrase_matcher.rb
will_paginate-3.0.9 spec/matchers/phrase_matcher.rb
will_paginate-3.1.2 spec/matchers/phrase_matcher.rb
will_paginate-3.1.1 spec/matchers/phrase_matcher.rb
will_paginate-3.0.8 spec/matchers/phrase_matcher.rb
will_paginate-3.1.0 spec/matchers/phrase_matcher.rb
will_paginate_seo-3.0.4 spec/matchers/phrase_matcher.rb
will_paginate-3.0.7 spec/matchers/phrase_matcher.rb
will_paginate-3.0.6 spec/matchers/phrase_matcher.rb