Sha256: da43420ed86415e0c729b79ad1d6abc7190b80244dac5c468f81f813a35e27f9

Contents?: true

Size: 947 Bytes

Versions: 1

Compression:

Stored size: 947 Bytes

Contents

require 'rspec'
require 'view_helpers/view_example_group'
begin
  require 'ruby-debug'
rescue LoadError
  # no debugger available
end

Dir[File.expand_path('../matchers/*_matcher.rb', __FILE__)].each { |matcher| require matcher }

RSpec.configure do |config|
  config.include Module.new {
    protected

    def include_phrase(string)
      PhraseMatcher.new(string)
    end

    def have_deprecation(msg)
      DeprecationMatcher.new(msg)
    end

    def run_queries(num)
      QueryCountMatcher.new(num)
    end

    def ignore_deprecation
      ActiveSupport::Deprecation.silence { yield }
    end

    def show_queries(&block)
      counter = QueryCountMatcher.new(nil)
      counter.run block
    ensure
      queries = counter.performed_queries
      if queries.any?
        puts queries
      else
        puts "no queries"
      end
    end
  }

  config.mock_with :mocha
  config.backtrace_exclusion_patterns << /view_example_group/
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
will_paginate-3.3.0 spec/spec_helper.rb