diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-06-27 11:49:10 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-06-27 11:49:10 +0200 |
commit | 06fe1fe549d6c7dbb643a07a485d24c3e45216d3 (patch) | |
tree | 90947a79c9732a3424b28fd972de06e070e95c53 /spec/link_spec.rb | |
parent | 2526cd9aef3bb7dc04901be4067dd211f03fe9b5 (diff) | |
parent | 7cfcad744d3e18cbe8a9f71c43a0cad1e8fdd6b4 (diff) | |
download | edoors-ruby-06fe1fe549d6c7dbb643a07a485d24c3e45216d3.zip edoors-ruby-06fe1fe549d6c7dbb643a07a485d24c3e45216d3.tar.gz |
Merge branch 'rewrite0'
Diffstat (limited to 'spec/link_spec.rb')
-rw-r--r-- | spec/link_spec.rb | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/spec/link_spec.rb b/spec/link_spec.rb index 0de1d93..49f086a 100644 --- a/spec/link_spec.rb +++ b/spec/link_spec.rb @@ -10,26 +10,23 @@ describe Edoors::Link do @spin = Edoors::Spin.new 'dom0' p = @spin.require_p Edoors::Particle p.set_data Edoors::LNK_SRC, 'input1' - p.set_data Edoors::LNK_DSTS, 'concat1?follow,output1' - p.set_data Edoors::LNK_FIELDS, 'f0,f2' - p.set_data Edoors::LNK_CONDF, 'f0,f1,f2' - p.set_data Edoors::LNK_CONDV, 'v0v1v2' - lnk = Edoors::Link.from_particle_data p + p.set_data Edoors::LNK_DSTS, ['concat1?follow','output1'] + p.set_data Edoors::LNK_KEYS, ['f0','f2'] + p.set_data Edoors::LNK_VALUE, {'f0'=>'v0','f1'=>'v1','f2'=>'v2'} + lnk = Edoors::Link.from_particle p lnk.src.should eql 'input1' - lnk.dsts.should eql 'concat1?follow,output1' - lnk.fields.should eql 'f0,f2' - lnk.cond_fields.should eql 'f0,f1,f2' - lnk.cond_value.should eql 'v0v1v2' + lnk.dsts.should eql ['concat1?follow','output1'] + lnk.keys.should eql ['f0','f2'] + lnk.value.should == {'f0'=>'v0','f1'=>'v1','f2'=>'v2'} end # it "link->json->link" do - link = Edoors::Link.new 'input1', 'concat1?follow,output1', 'f0,f2', 'f0,f1,f2', 'v0v1v2' + link = Edoors::Link.new 'input1', ['concat1?follow','output1'], ['f0','f2'], {'f0'=>'v0','f1'=>'v1','f2'=>'v2'} lnk = Edoors::Link.json_create( JSON.load( JSON.generate(link) ) ) link.src.should eql lnk.src link.dsts.should eql lnk.dsts - link.fields.should eql lnk.fields - link.cond_fields.should eql lnk.cond_fields - link.cond_value.should eql lnk.cond_value + link.keys.should eql lnk.keys + link.value.should eql lnk.value JSON.generate(link).should eql JSON.generate(lnk) end # |