Sha256: b54dc28209056f5bf4e4b0710bece2a906b92e5a8337bd2c699752c89dd02b7b

Contents?: true

Size: 1.28 KB

Versions: 21

Compression:

Stored size: 1.28 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'
require 'puppet/pops'

# relative to this spec file (./) does not work as this file is loaded by rspec
require File.join(File.dirname(__FILE__), '/parser_rspec_helper')

describe "egrammar parsing of capability mappings" do
  include ParserRspecHelper

  before(:each) do
    with_app_management(true)
  end

  after(:each) do
    with_app_management(false)
  end

  context "when parsing 'produces'" do
    it "the ast contains produces and attributes" do
      prog = "Foo produces Sql { name => value }"
      ast = "(produces Foo Sql ((name => value)))"
      expect(dump(parse(prog))).to eq(ast)
    end

    it "optional end comma is allowed" do
      prog = "Foo produces Sql { name => value, }"
      ast = "(produces Foo Sql ((name => value)))"
      expect(dump(parse(prog))).to eq(ast)
    end
  end

  context "when parsing 'consumes'" do
    it "the ast contains consumes and attributes" do
      prog = "Foo consumes Sql { name => value }"
      ast = "(consumes Foo Sql ((name => value)))"
      expect(dump(parse(prog))).to eq(ast)
    end

    it "optional end comma is allowed" do
      prog = "Foo consumes Sql { name => value, }"
      ast = "(consumes Foo Sql ((name => value)))"
      expect(dump(parse(prog))).to eq(ast)
    end

  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
puppet-4.3.0-x64-mingw32 spec/unit/pops/parser/parse_capabilities_spec.rb