Sha256: e8059eb51847259eebfef74103a4985038e64f9e3f97199e3ff5094db10410d0

Contents?: true

Size: 499 Bytes

Versions: 20

Compression:

Stored size: 499 Bytes

Contents

require 'stringio'

class DeprecationMatcher
  def initialize(message)
    @message = message
  end

  def matches?(block)
    @actual = hijack_stderr(&block)
    PhraseMatcher.new("DEPRECATION WARNING: #{@message}").matches?(@actual)
  end

  def failure_message
    "expected deprecation warning #{@message.inspect}, got #{@actual.inspect}"
  end

  private

  def hijack_stderr
    err = $stderr
    $stderr = StringIO.new
    yield
    $stderr.string.rstrip
  ensure
    $stderr = err
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

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