[LRUG] problems with YAML

aidy lewis aidy.lewis at googlemail.com
Thu Feb 28 08:40:53 PST 2008


Thanks Andy

But what if I need to run the tests again with different YAML data.

Aidy

On 28/02/2008, Andrew Stewart <boss at airbladesoftware.com> wrote:
>
> On 28 Feb 2008, at 15:47, aidy lewis wrote:
> >  The trouble I am having is that the hash within  the #register method
> > isnil after it is invoked.
>
> Does this do what you want?
>
> require 'yaml'
>
> yaml = <<END
> test: tiscali
> url:  http://tiscali3-test.vizumi.com/
> register:
>   first_name: aidy
>   surname: smith
>   email: 'testautomated6 at googlemail.com'
>   password: password
>   registration: KJHDF123
> END
>
> class SmokeTest
>   attr_accessor :test, :url, :register
>
>   def initialize test, url, register
>     @test = test
>     @url = url
>     @register = register
>   end
> end
>
> obj = YAML.load yaml
> smoke_test = SmokeTest.new obj['test'], obj['url'], obj['register']
> %w( test url register ).each do |method|
>   puts "#{method}: #{smoke_test.send(method).inspect}"
> end
>
> Regards,
> Andy Stewart
>
> -------
> http://airbladesoftware.com
>
>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>



More information about the Chat mailing list