Sha256: fd3a640c8fdbe7d5764e0d8d6da6eb419429d52bc05f346ca2b5de5e6102fa4c

Contents?: true

Size: 980 Bytes

Versions: 9

Compression:

Stored size: 980 Bytes

Contents

require 'rubygems'
# require 'simplecov'
# SimpleCov.start
RAILS_VERSION = ENV['RAILS_VERSION'] || '~> 3.0.0'
#puts "Testing with Rails #{RAILS_VERSION}"
gem 'rails', RAILS_VERSION

require 'test/unit'
require 'shoulda'
require 'memcached_mock'
require 'mocha'

require 'dalli'

class Test::Unit::TestCase
  include MemcachedMock::Helper

  def rails3?
    RAILS_VERSION =~ /3\.0\./
  end

  def assert_error(error, regexp=nil, &block)
    ex = assert_raise(error, &block)
    assert_match(regexp, ex.message, "#{ex.class.name}: #{ex.message}\n#{ex.backtrace.join("\n\t")}")
  end

  def with_activesupport
    case 
    when rails3?
      require 'active_support/all'
    else
      require 'active_support'
      require 'active_support/cache/dalli_store23'
    end
    yield
  end

  def with_actionpack
    case
    when rails3?
      require 'action_dispatch'
      require 'action_controller'
    # when '2.3.0'
    #   raise NotImplementedError
    end
    yield
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dalli-0.11.0 test/helper.rb
dalli-0.10.1 test/helper.rb
dalli-0.10.0 test/helper.rb
dalli-0.9.10 test/helper.rb
dalli-0.9.9 test/helper.rb
dalli-0.9.8 test/helper.rb
dalli-0.9.7 test/helper.rb
dalli-0.9.6 test/helper.rb
dalli-0.9.5 test/helper.rb