Class: Jeka::TestCase

Inherits:
Object
  • Object
show all
Defined in:
lib/jeka/test_case.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#databaseObject (readonly)

Returns the value of attribute database.



4
5
6
# File 'lib/jeka/test_case.rb', line 4

def database
  @database
end

Class Method Details

.inherited(klass) ⇒ Object



22
23
24
25
# File 'lib/jeka/test_case.rb', line 22

def self.inherited(klass)
  @@test_suites ||= {}
  @@test_suites[klass] = true
end

.resetObject



18
19
20
# File 'lib/jeka/test_case.rb', line 18

def self.reset
  @@test_suites = {}
end

.test(name) {|t| ... } ⇒ Object

Yields:

  • (t)


10
11
12
13
14
15
16
# File 'lib/jeka/test_case.rb', line 10

def self.test(name)
  t = Test.new(name)
  yield t
  define_method("test_#{name}".to_sym) do
    return t
  end
end

.test_suitesObject



27
28
29
30
# File 'lib/jeka/test_case.rb', line 27

def self.test_suites
  @@test_suites ||= {}
  @@test_suites.keys.sort_by { |ts| ts.name }.collect{|ts| ts.new}
end

Instance Method Details

#jekafyObject



32
33
34
35
36
37
# File 'lib/jeka/test_case.rb', line 32

def jekafy
  @database = Jeka::Analysis::TestCase.create!(
    name: self.class.to_s,
    tests: tests.collect {|t| t.jekafy}
  )
end

#testsObject



6
7
8
# File 'lib/jeka/test_case.rb', line 6

def tests
  methods.select {|m| m =~ /^test_/}.map {|m| send(m)}
end