Sha256: 44264b4e9fcc38ec6b6b2a120ad3533db127a5df8d04d28ce244300c9308d249

Contents?: true

Size: 893 Bytes

Versions: 6

Compression:

Stored size: 893 Bytes

Contents

#! /usr/bin/env ruby -S rspec
require 'spec_helper'

describe "the suffix function" do
  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }

  it "raises a ParseError if there is less than 1 arguments" do
    expect { scope.function_suffix([]) }.to raise_error(Puppet::ParseError, /number of arguments/)
  end

  it "raises an error if the first argument is not an array" do
    expect {
      scope.function_suffix([Object.new])
    }.to raise_error(Puppet::ParseError, /expected first argument to be an Array/)
  end

  it "raises an error if the second argument is not a string" do
    expect {
      scope.function_suffix([['first', 'second'], 42])
    }.to raise_error(Puppet::ParseError, /expected second argument to be a String/)
  end

  it "returns a suffixed array" do
    result = scope.function_suffix([['a','b','c'], 'p'])
    expect(result).to(eq(['ap','bp','cp']))
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
puppet-retrospec-0.12.1 spec/fixtures/modules/stdlib/spec/functions/suffix_spec.rb
puppet-retrospec-0.12.0 spec/fixtures/modules/stdlib/spec/functions/suffix_spec.rb
puppet-retrospec-0.11.0 spec/fixtures/modules/stdlib/spec/functions/suffix_spec.rb
puppet-retrospec-0.10.0 spec/fixtures/modules/stdlib/spec/functions/suffix_spec.rb
puppet-retrospec-0.9.1 spec/fixtures/modules/stdlib/spec/functions/suffix_spec.rb
puppet-retrospec-0.9.0 spec/fixtures/modules/stdlib/spec/functions/suffix_spec.rb