Sha256: c8ed05cb9916dda168400ab2cf0b9dd4f23eac1176b85e3af8e0fa30bb4383c8

Contents?: true

Size: 617 Bytes

Versions: 64

Compression:

Stored size: 617 Bytes

Contents

# -*- encoding : utf-8 -*-
# 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

64 entries across 64 versions & 1 rubygems

Version Path
blacklight-5.5.1 spec/support/include_text.rb
blacklight-5.5.0 spec/support/include_text.rb
blacklight-5.4.0 spec/support/include_text.rb
blacklight-5.4.0.rc1 spec/support/include_text.rb
blacklight-5.3.0 spec/support/include_text.rb
blacklight-5.0.3 spec/support/include_text.rb
blacklight-5.1.1 spec/support/include_text.rb
blacklight-5.2.0 spec/support/include_text.rb
blacklight-5.1.0 spec/support/include_text.rb
blacklight-5.0.2 spec/support/include_text.rb
blacklight-5.0.1 spec/support/include_text.rb
blacklight-5.0.0 spec/support/include_text.rb
blacklight-4.7.0 spec/support/include_text.rb
blacklight-4.7.0.pre1 spec/support/include_text.rb
blacklight-5.0.0.pre4 spec/support/include_text.rb
blacklight-4.6.3 spec/support/include_text.rb
blacklight-5.0.0.pre3 spec/support/include_text.rb
blacklight-4.6.2 spec/support/include_text.rb
blacklight-5.0.0.pre2 spec/support/include_text.rb
blacklight-4.6.1 spec/support/include_text.rb