Sha256: e34982ac5786965840591b8f1128c443190fabf6f330f3ea50d19286ec573718

Contents?: true

Size: 770 Bytes

Versions: 6

Compression:

Stored size: 770 Bytes

Contents

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

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

  it "should exist" do
    expect(Puppet::Parser::Functions.function("swapcase")).to eq("function_swapcase")
  end

  it "should raise a ParseError if there is less than 1 arguments" do
    expect { scope.function_swapcase([]) }.to( raise_error(Puppet::ParseError))
  end

  it "should swapcase a string" do
    result = scope.function_swapcase(["aaBBccDD"])
    expect(result).to(eq('AAbbCCdd'))
  end

  it "should accept objects which extend String" do
    class AlsoString < String
    end

    value = AlsoString.new("aaBBccDD")
    result = scope.function_swapcase([value])
    result.should(eq("AAbbCCdd"))
  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/swapcase_spec.rb
puppet-retrospec-0.12.0 spec/fixtures/modules/stdlib/spec/functions/swapcase_spec.rb
puppet-retrospec-0.11.0 spec/fixtures/modules/stdlib/spec/functions/swapcase_spec.rb
puppet-retrospec-0.10.0 spec/fixtures/modules/stdlib/spec/functions/swapcase_spec.rb
puppet-retrospec-0.9.1 spec/fixtures/modules/stdlib/spec/functions/swapcase_spec.rb
puppet-retrospec-0.9.0 spec/fixtures/modules/stdlib/spec/functions/swapcase_spec.rb