Sha256: 802d1026f557f47d4bae69eeff8c8cbe50c6f3433e38ea9e9abe5245eaf223e0

Contents?: true

Size: 1003 Bytes

Versions: 2

Compression:

Stored size: 1003 Bytes

Contents

$LOAD_PATH.delete_if { |path| path[/gems\/vanity-\d/] }
$LOAD_PATH.unshift File.expand_path("../lib", File.dirname(__FILE__))
RAILS_ROOT = File.expand_path("..")
require "minitest/spec"
require "mocha"
require "action_controller"
require "action_controller/test_case"
require "lib/vanity/rails"
MiniTest::Unit.autorun

class MiniTest::Unit::TestCase
  # Call this on teardown. It wipes put the playground and any state held in it
  # (mostly experiments), resets vanity ID, and clears Redis of all experiments.
  def nuke_playground
    Vanity.playground.redis.flushdb
    new_playground
  end

  # Call this if you need a new playground, e.g. to re-define the same experiment,
  # or reload an experiment (saved by the previous playground).
  def new_playground
    Vanity.instance_variable_set :@playground, Vanity::Playground.new
  end

  def teardown
    nuke_playground
    Vanity.context = nil
  end
end

ActionController::Routing::Routes.draw do |map|
  map.connect ':controller/:action/:id'
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vanity-0.3.1 test/test_helper.rb
vanity-0.3.0 test/test_helper.rb