Class: Goz::TestCase

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/goz/test_case.rb

Overview

Goz::TestCase - Goz test case.

Author

blair christensen. <[email protected]>

Homepage

github.com/blairc/goz/

Direct Known Subclasses

Group::TestCase, User::TestCase

Instance Method Summary collapse

Instance Method Details

#setupObject



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
49
50
51
52
53
54
55
# File 'lib/goz/test_case.rb', line 23

def setup
  super
  Goz::Database.instance do |db|
    [ :admins, :events, :group_services, :members ].each { |t| db[t].delete }
    [ :groups, :services, :users ].each { |t| db[t].delete }
  end

  @groups = {}
  [ :a, :b ].each do |sym|
    @groups[sym] = { :display_name => "Group:#{ sym.to_s.upcase }",
                     :identifier   => Digest::SHA1.hexdigest( sym.to_s ),
                     :klass        => 'Goz::Group',
                     :name         => "g#{ sym.to_s.upcase }"
                   }
  end

  @services = {}
  [ :a, :b ].each do |sym|
    @services[sym] = { :name  => "Service #{ sym.to_s.upcase }",
                       :klass => 'Goz::Service'
                     }
  end

  @users = {}
  [ :a, :b ].each do |sym|
    @users[sym] = { :email      => "#{ sym.to_s }@example.org",
                    :identifier => Digest::SHA1.hexdigest( sym.to_s ),
                    :klass      => 'Goz::User',
                    :login      => sym.to_s,
                    :name       => "User #{ sym.to_s.upcase }"
                   }
  end
end