diff options
author | Saku Ytti <saku@ytti.fi> | 2013-04-19 12:36:45 +0300 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2013-04-19 12:41:29 +0300 |
commit | 96668cc2dc0367e3d1a3ec94265ce889b62d8ada (patch) | |
tree | 340f92a6dd4b68e41a946729c8fae34db7aff40b /spec | |
parent | 9d217025fac3e335c308f02e7377e14ccfdc0e66 (diff) |
Add restful API
Diffstat (limited to 'spec')
-rw-r--r-- | spec/nodes_spec.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/spec/nodes_spec.rb b/spec/nodes_spec.rb index ad51525..80ed300 100644 --- a/spec/nodes_spec.rb +++ b/spec/nodes_spec.rb @@ -1,15 +1,16 @@ -require 'oxidized/nodes' +require 'oxidized' +Oxidized.mgr = Oxidized::Manager.new describe Oxidized::Nodes do before(:each) do @nodes_org = %w(ltt-pe1.hel kes2-rr1.tku tor-peer1.oul - hal-p2.tre sav-gr1-sw1.kuo psl-sec-pe1.hel) + hal-p2.tre sav-gr1-sw1.kuo psl-sec-pe1.hel).map { |e| Oxidized::Node.new(:name=>e) } @nodes = Oxidized::Nodes.new @nodes_org.dup end describe '#put' do it 'adds node to top of queue' do - node = 'kst-p1.sto' + node = Oxidized::Node.new(:name=>'kst-p1.sto') @nodes.put node expect(@nodes).to eq [node] + @nodes_org end @@ -30,15 +31,15 @@ describe Oxidized::Nodes do end end - describe '#top' do + describe '#next' do it 'moves node to top of queue' do node = @nodes[3] - @nodes.top node + @nodes.next node.name expect(@nodes).to start_with [node] end it 'does not change node count' do before = @nodes.size - @nodes.top @nodes[3] + @nodes.next @nodes[3].name expect(before).to eq @nodes.size end end |