0.0
No commit activity in last 3 years
No release in over 3 years
testdata_text
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.8.0, ~> 1.8
>= 0.6.0, ~> 0.2
 Project Readme

Introducing the Testdata text gem

require 'testdata_text'

# the following text is an example of the manually input chronic_cron test data
# prior to being transformed to XML (specifically testdata Polyrex format).
 
txt =<<EOF
title: chronic_cron testdata
ruby_version: ruby-1.9.2-p180
script: //job:test http://rorbuilder.info/r/gemtest/chronic_cron.rsf
test_dir: /home/james/test-ruby/chronic_cron

path: 1
type: date only
desc:

input:
  date: 22-Apr-2011 12:34
  entry: * * * * *

output:
  date: 2011-04-22 12:34

------------------------------

path: 2
type: date only
desc:

input:
  date: 22-Apr-2011 12:34
  entry: * * * * *

output:
  date: 2011-04-22 12:34

------------------------------
EOF

xml = TestdataText.parse(txt)
#=>
<?xml version="1.0"?>  
<summary>
  <title>chronic_cron testdata</title>
  <recordx_type>polyrex</recordx_type>
  <schema>tests/test[path,type,description]/io[type,*]</schema>
  <ruby_version>ruby-1.9.2-p180</ruby_version>
  <script>//job:test http://rorbuilder.info/r/gemtest/chronic_cron.rsf</script>
  <test_dir>/home/james/test-ruby/chronic_cron</test_dir>
</summary>
<records>
  <test>
    <summary>
      <path>1</path>   
      <type>date only</type>
      <description>date only</description>
    </summary>
    <records>
      <io>
        <summary>
          <type>input</type>
          <date>22-Apr-2011 12:34</date>
          <entry>* * * * *</entry>
        </summary>
        <records/>
      </io>
... 

The Testdata text gem is used for transforming text into XML for input into the testdata gem. I've found over the past few months that editing inputs in XML format can be tedious which is why I'm experimenting with using this simpler approach. Note: If any of the initial text values contain angle brackets the value will automatically be wrapped within a CDATA element.

Resources