Sha256: 16f20d0a6da2ea5a3c5cdab09091e63e48e0a241430afa845210dcc133ceb086

Contents?: true

Size: 603 Bytes

Versions: 29

Compression:

Stored size: 603 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 do |text|
        "expected '#{@content}' to contain '#{text}'"
      end

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

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
blacklight-5.15.0 spec/support/include_text.rb
blacklight-5.14.0 spec/support/include_text.rb
blacklight-5.13.1 spec/support/include_text.rb
blacklight-5.13.0 spec/support/include_text.rb
blacklight-5.11.3 spec/support/include_text.rb
blacklight-5.12.1 spec/support/include_text.rb
blacklight-5.12.0 spec/support/include_text.rb
blacklight-5.10.3 spec/support/include_text.rb
blacklight-5.9.4 spec/support/include_text.rb
blacklight-5.11.2 spec/support/include_text.rb
blacklight-5.11.1 spec/support/include_text.rb
blacklight-5.11.0 spec/support/include_text.rb
blacklight-5.10.2 spec/support/include_text.rb
blacklight-5.10.1 spec/support/include_text.rb
blacklight-5.10.0 spec/support/include_text.rb
blacklight-5.9.3 spec/support/include_text.rb
blacklight-5.9.2 spec/support/include_text.rb
blacklight-5.9.1 spec/support/include_text.rb
blacklight-5.9.0 spec/support/include_text.rb
blacklight-5.8.2 spec/support/include_text.rb