Sha256: 69efcd511dfd0d597c12667eb602d4ed3820cf7ef8674b1b009df4994ac24956

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

module Theotokos
  module Engine

    class Parser
    
      def self.yaml_to_test_suite(source)
        Parser.hash_to_test_suite Parser.yaml_to_hash(source)
      end
    
      def self.yaml_to_hash(source)
        raise Exception, "File #{source} does not exist." unless File.exist? source
        YAML.load_file source
      end
      
      def self.hash_to_test_suite(hash)
        Model::TestSuite.new do |suite|
          suite.wsdl = hash['wsdl']
          suite.service = hash['service']
          suite.description = hash['description']
          suite.tags = hash['tags']
          
          suite.tests = hash['tests'].map do |te|
            Model::Test.new do |t|
              t.name = te['name']
              t.description = te['description']
              t.input = te['input']
              t.output = te['output']
              t.tags = te['tags']
              t.ws_security = te['ws-security']
              t.error_expected = te['error_expected']
            end
          end unless hash['tests'].nil?
        end
      end
    
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
theotokos-0.1.3 lib/engine/parser.rb
theotokos-0.1.2 lib/engine/parser.rb
theotokos-0.1.1 lib/engine/parser.rb