Sha256: 5e2e4ac598d30d6cc77ce505e8288496d9415d81318bfbed34541d38e0a209fa

Contents?: true

Size: 913 Bytes

Versions: 5

Compression:

Stored size: 913 Bytes

Contents

require 'spec_helper'
require 'puppet-strings/yard'

describe PuppetStrings::Yard::Util do
  subject {PuppetStrings::Yard::Util}

  describe 'scrub_string' do
    it 'should remove `%Q` and its brackets from a string ' do
      str = "%Q{this is a test string}"
      expect(subject.scrub_string(str)).to eq('this is a test string')
    end

    it 'should remove `%q` and its brackets from a string' do
      str = "%q{this is a test string}"
      expect(subject.scrub_string(str)).to eq('this is a test string')
    end

    it 'should not affect newlines when %Q notation is used' do
      str = <<-STR
%Q{this is
a test string}
STR
      expect(subject.scrub_string(str)).to eq("this is\na test string")
    end

    it 'should not affect a string which does not use %Q notation' do
      str = "this is a test string"
      expect(subject.scrub_string(str)).to eq('this is a test string')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
puppet-strings-1.2.1 spec/unit/puppet-strings/yard/util_spec.rb
puppet-strings-1.2.0 spec/unit/puppet-strings/yard/util_spec.rb
puppet-strings-1.1.1 spec/unit/puppet-strings/yard/util_spec.rb
puppet-strings-1.1.0 spec/unit/puppet-strings/yard/util_spec.rb
puppet-strings-1.0.0 spec/unit/puppet-strings/yard/util_spec.rb