Sha256: 8ada6706f86cfed77e9b9cbc523b8abedf018aedc23d56199982dbe273417d6b

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

# Test Helper
$:.unshift File.dirname(__FILE__) + '/../'

begin
  require 'rubygems'
rescue LoadError
end

require 'minitest/autorun'
require 'rack/test'
require 'minitest/reporters'
require 'minitest/hooks'
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true)]

# Default TestCase with some helpers.
# The same stuff we use for Camping itself.
class TestCase < MiniTest::Test
  include Rack::Test::Methods
  include Minitest::Hooks

  def self.inherited(mod)
    mod.app = Object.const_get(mod.to_s[/w+/])
    super
  end

  class << self
    attr_accessor :app
  end

  def setup
    super
    Camping.make_camp
  end

  def body() last_response.body end
  def app()  self.class.app     end

  def response_body() last_response.to_a end

  def assert_reverse
    begin
      yield
    rescue Exception
    else
      assert false, "Block didn't fail"
    end
  end

  def assert_body(str, message="")
    case str
    when Regexp
      assert_match(str, last_response.body.strip, message)
    else
      assert_equal(str.to_s, last_response.body.strip, message)
    end
  end

  def assert_status(code, message="")
    assert_equal(code, last_response.status, message)
  end

  def test_silly; end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
camping-3.2.3 test/integration/test/test_helper.r