| Class | Uttk::Strategies::Test |
| In: |
lib/uttk/strategies/Test.rb
|
| Parent: | Proxy |
A strategy to test them all.
FIXME: add support to test filter
# File lib/uttk/strategies/Test.rb, line 21 def initialize(*a, &b) super @outfile = nil end
# File lib/uttk/strategies/Test.rb, line 46 def assertion returned_log = nil @outfile.open { |io| returned_log = YAML.load(io) } unless returned_log.is_a?(Hash) or returned_log.is_a?(Array) raise('the result must be either a hash or an array') end del_ignored_value(returned_log) del_ignored_value(@expected_log) diff = @expected_log.gen_diff(returned_log) {|a, b| a.to_s == b.to_s} if diff.no_diff? pass else @log[:differences] = diff fail('there is differences') end super end
# File lib/uttk/strategies/Test.rb, line 71 def del_ignored_value(hash) hash.delete_if {|k, _| @ignored_value.include?(k.to_s)} end
# File lib/uttk/strategies/Test.rb, line 27 def prologue super @outfile = TempPath.new create(@test) end
# File lib/uttk/strategies/Test.rb, line 34 def run_impl_test(test, log) test.reject :name, :status, :strategy # FIXME : Try to remove this if possible my_log = nil @outfile.open('w') do |io| my_log = Logger.new(Dumpers::Yaml.new(io)) @returned_status = super(test, my_log) my_log.close if my_log end @returned_status end