Sha256: 5aa03d47d90216afc89995e01f0f8b0b3f55b28df5bc79b615d85890db56acc5

Contents?: true

Size: 590 Bytes

Versions: 5

Compression:

Stored size: 590 Bytes

Contents

# Added from http://www.arctickiwi.com/blog/upgrading-to-rspec-2-with-ruby-on-rails-3
module RSpec::Rails
  module Matchers
    RSpec::Matchers.define :include_text do |text|
      match do |response_or_text|
        @content = response_or_text.respond_to?(:body) ? response_or_text.body : response_or_text
        @content.include?(text)
      end

      failure_message_for_should do |text|
        "expected '#{@content}' to contain '#{text}'"
      end

      failure_message_for_should_not do |text|
        "expected #{@content} to not contain '#{text}'"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-3.0.0pre6 test_support/spec/support/include_text.rb
blacklight-3.0.0pre4 test_support/spec/support/include_text.rb
blacklight-3.0.0pre3 test_support/spec/support/include_text.rb
blacklight-3.0pre2 test_support/spec/support/include_text.rb
blacklight-3.0pre1 test_app/spec/support/include_text.rb