summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2013-04-17 17:48:50 +0300
committerSaku Ytti <saku@ytti.fi>2013-04-17 17:48:50 +0300
commit9d217025fac3e335c308f02e7377e14ccfdc0e66 (patch)
treeb90d4d04947fe26a9e592e12d8c4352142380c03 /spec
Initial commit
Silly for shit-and-giggles attempt at rancid
Diffstat (limited to 'spec')
-rw-r--r--spec/nodes_spec.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/nodes_spec.rb b/spec/nodes_spec.rb
new file mode 100644
index 0000000..ad51525
--- /dev/null
+++ b/spec/nodes_spec.rb
@@ -0,0 +1,45 @@
+require 'oxidized/nodes'
+
+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)
+ @nodes = Oxidized::Nodes.new @nodes_org.dup
+ end
+
+ describe '#put' do
+ it 'adds node to top of queue' do
+ node = 'kst-p1.sto'
+ @nodes.put node
+ expect(@nodes).to eq [node] + @nodes_org
+ end
+ end
+
+ describe '#get' do
+ it 'returns node from top of queue' do
+ expect(@nodes.get).to eq @nodes_org.first
+ end
+ it 'moves node from top to bottom' do
+ @nodes.get
+ expect(@nodes).to end_with [@nodes_org.first]
+ end
+ it 'does not change node count' do
+ before = @nodes.size
+ @nodes.get
+ expect(before).to eq @nodes.size
+ end
+ end
+
+ describe '#top' do
+ it 'moves node to top of queue' do
+ node = @nodes[3]
+ @nodes.top node
+ expect(@nodes).to start_with [node]
+ end
+ it 'does not change node count' do
+ before = @nodes.size
+ @nodes.top @nodes[3]
+ expect(before).to eq @nodes.size
+ end
+ end
+end