File: teststrap.rb

package info (click to toggle)
ruby-rabl 0.16.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,276 kB
  • sloc: ruby: 6,732; javascript: 102; makefile: 6
file content (48 lines) | stat: -rw-r--r-- 936 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))

module Kernel
  def silence_warnings
    with_warnings(nil) { yield }
  end

  def with_warnings(flag)
    old_verbose, $VERBOSE = $VERBOSE, flag
    yield
  ensure
    $VERBOSE = old_verbose
  end
end unless Kernel.respond_to? :silence_warnings

silence_warnings do
  require 'riot'
  require 'riot/rr'
  require 'tilt'
  require 'rabl'
  require 'hashie'
  require File.expand_path('../models/user', __FILE__)
end

if $stdout.tty? then
  Riot.pretty_dots
else
  Riot.dots
  Riot.plain!
end

module RiotTestHelpers
  def char_split(str)
    str.force_encoding("iso-8859-1").split("").sort
  end

  def clean_plist(text)
    text.gsub(%r{<!DOCTYPE plist PUBLIC \"-//([\w\s]+?)//DTD PLIST 1.0//EN\"}, %q{<!DOCTYPE plist PUBLIC \"-//(TEST)//DTD PLIST 1.0//EN\"})
  end
end

class Riot::Situation
  include RiotTestHelpers
end

class Riot::Context
  include RiotTestHelpers
end