File: containment_spec.rb

package info (click to toggle)
puppet 4.8.2-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 20,736 kB
  • ctags: 14,616
  • sloc: ruby: 236,754; xml: 1,586; sh: 1,178; lisp: 299; sql: 103; yacc: 72; makefile: 52
file content (26 lines) | stat: -rw-r--r-- 917 bytes parent folder | download | duplicates (2)
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
require 'spec_helper'
require 'puppet/pops'
require File.join(File.dirname(__FILE__), 'factory_rspec_helper')

describe Puppet::Pops::Containment do
  include FactoryRspecHelper

  it "Should return an Enumerable if eAllContents is called without arguments" do
    expect((literal(1) + literal(2)).current.eAllContents.is_a?(Enumerable)).to eq(true)
  end

  it "Should return all content" do
    # Note the top object is not included (an ArithmeticOperation with + operator)
    expect((literal(1) + literal(2) + literal(3)).current.eAllContents.collect {|x| x}.size).to eq(4)
  end

  it "Should return containing feature" do
    left = literal(1)
    right = literal(2)
    op = left + right

    #pending "eContainingFeature does not work on _uni containments in RGen < 0.6.1"
    expect(left.current.eContainingFeature).to eq(:left_expr)
    expect(right.current.eContainingFeature).to eq(:right_expr)
  end
end