annotate modules/stdlib/spec/functions/capitalize_spec.rb @ 157:c6b1b42f3e4b puppet-3.6

Move all sites to separate LetsEncrypt certs to make adding future domains easier
author IBBoard <dev@ibboard.co.uk>
date Thu, 30 Mar 2017 20:41:18 +0100
parents addb0ea390a1
children c42fb28cff86
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 #! /usr/bin/env ruby -S rspec
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 require 'spec_helper'
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 describe "the capitalize function" do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 it "should exist" do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 expect(Puppet::Parser::Functions.function("capitalize")).to eq("function_capitalize")
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 it "should raise a ParseError if there is less than 1 arguments" do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 expect { scope.function_capitalize([]) }.to( raise_error(Puppet::ParseError))
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 it "should capitalize the beginning of a string" do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 result = scope.function_capitalize(["abc"])
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 expect(result).to(eq("Abc"))
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 it "should accept objects which extend String" do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 class AlsoString < String
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 value = AlsoString.new('abc')
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 result = scope.function_capitalize([value])
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 result.should(eq('Abc'))
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 end