File: include_spec.rb

package info (click to toggle)
puppet 5.5.10-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 21,116 kB
  • sloc: ruby: 250,669; sh: 1,620; xml: 218; makefile: 151; sql: 103
file content (32 lines) | stat: -rw-r--r-- 927 bytes parent folder | download | duplicates (7)
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
require 'spec_helper'
require 'matchers/include'

describe "include matchers" do
  include Matchers::Include

  context :include_in_any_order do
    it "matches an empty list" do
      expect([]).to include_in_any_order()
    end

    it "matches a list with a single element" do
      expect([1]).to include_in_any_order(eq(1))
    end

    it "does not match when an expected element is missing" do
      expect([1]).to_not include_in_any_order(eq(2))
    end

    it "matches a list with 2 elements in a different order from the expectation" do
      expect([1, 2]).to include_in_any_order(eq(2), eq(1))
    end

    it "does not match when there are more than just the expected elements" do
      expect([1, 2]).to_not include_in_any_order(eq(1))
    end

    it "matches multiple, equal elements when there are multiple, equal exepectations" do
      expect([1, 1]).to include_in_any_order(eq(1), eq(1))
    end
  end
end