summaryrefslogtreecommitdiff
path: root/spec/unit/graph/key_spec.rb
blob: 6d4df362fd4191a6adcce8985930d10c1bbaf91b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require 'spec_helper'

require 'puppet/graph'

describe Puppet::Graph::Key do
  it "produces the next in the sequence" do
    key = Puppet::Graph::Key.new

    expect(key.next).to be > key
  end

  it "produces a key after itself but before next" do
    key = Puppet::Graph::Key.new
    expect(key.down).to be > key
    expect(key.down).to be < key.next
  end

  it "downward keys of the same group are in sequence" do
    key = Puppet::Graph::Key.new

    first = key.down
    middle = key.down.next
    last = key.down.next.next

    expect(first).to be < middle
    expect(middle).to be < last
    expect(last).to be < key.next
  end

  it "downward keys in sequential groups are in sequence" do
    key = Puppet::Graph::Key.new

    first = key.down
    middle = key.next
    last = key.next.down

    expect(first).to be < middle
    expect(middle).to be < last
    expect(last).to be < key.next.next
  end
end