File: init.rb

package info (click to toggle)
ruby-contest 0.1.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 112 kB
  • sloc: ruby: 196; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 672 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# ActiveStupor defines its own idiom for the class-level setup method
# (using callback chains). This hack is to ensure that Contest users can
# still call the setup method with a block.
if RAILS_ENV == 'test'
  require File.join(File.dirname(__FILE__), '..', 'lib', 'contest')
  require "active_support/test_case"
  
  class Test::Unit::TestCase
    class << self
      alias contest_setup setup
    end
  end
  
  class ActiveSupport::TestCase
    class << self
      alias activesupport_setup setup
    end
  
    def self.setup(*args, &block)
      if args.empty?
        contest_setup(&block)
      else
        activesupport_setup(*args)
      end
    end
  end
end