class Akui
Constants
- MOVED_TEMP
- VERSION
Public Class Methods
current()
click to toggle source
# File lib/akui.rb, line 156 def current @current_tests.first end
define()
click to toggle source
# File lib/akui.rb, line 190 def define instance_eval(&Proc.new) end
describe(path, name = nil) { || ... }
click to toggle source
# File lib/akui.rb, line 198 def describe path, name = nil if @current fail <<-EOF.strip NOTE: Do not use DESCRIBE in nested fashion. You can try, but it was not designed to work like this, in order to make my life easier w/ a simple implementation. Use it like this: describe { } describe { } describe { } EOF end tests.<<( @current = { :path => path, :name => name, :its => [] } ) yield @current = nil end
done?()
click to toggle source
# File lib/akui.rb, line 160 def done? running? && @current_tests.empty? end
it(name, script_str)
click to toggle source
# File lib/akui.rb, line 230 def it name, script_str if @current @current[:its] << { :name => name, :script => script_str } end end
past()
click to toggle source
# File lib/akui.rb, line 152 def past past.last end
print(*args)
click to toggle source
# File lib/akui.rb, line 169 def print *args type, o = args case type when nil, :all tests.map { |desc| print :desc, desc }.join "\n".freeze when :describe, :desc %^DESC <a href="#{Escape_Escape_Escape.relative_href o[:path].to_s}">#{Escape_Escape_Escape.html o[:path].to_s}</a> #{o[:name] && o[:name].inspect}\n^ + %^#{o[:its].map { |it| print :it, it }.join "\n"}^ when :it %^ it #{o[:name].inspect}\n#{o[:script]}^ else fail ArgumentError, "Unknown args: #{args.inspect}" end end
reset()
click to toggle source
# File lib/akui.rb, line 131 def reset @current_tests = tests.map { |d| d[:its].map { |i| i = i.dup i[:parent] = d i } }.flatten @current_tests.unshift false @results = [] @past = [] end
running?()
click to toggle source
# File lib/akui.rb, line 164 def running? return false if !@current_tests true end
shift()
click to toggle source
# File lib/akui.rb, line 144 def shift t = @current_tests.shift if @current_tests.empty? end @past.push t t end
stop()
click to toggle source
# File lib/akui.rb, line 127 def stop @current_tests = nil end
tests()
click to toggle source
# File lib/akui.rb, line 194 def tests @tests ||= [] end