Sha256: 1d8a741e06ae4a08437a2e78f342c8848e1940a9cbe7b3bafc857232a8918d35

Contents?: true

Size: 973 Bytes

Versions: 5

Compression:

Stored size: 973 Bytes

Contents

# frozen_string_literal: true

module GitHubChangelogGenerator
  RSpec.describe Section do
    let(:options) { {} }
    subject(:section) { described_class.new(options) }

    describe "#encapsulate_string" do
      let(:string) { "" }

      context "with the empty string" do
        it "returns the string" do
          expect(section.send(:encapsulate_string, string)).to eq string
        end
      end

      context "with a string with an escape-needing character in it" do
        let(:string) { "<Inside> and outside" }

        it "returns the string escaped" do
          expect(section.send(:encapsulate_string, string)).to eq '\\<Inside\\> and outside'
        end
      end

      context "with a backticked string with an escape-needing character in it" do
        let(:string) { 'back `\` slash' }

        it "returns the string" do
          expect(section.send(:encapsulate_string, string)).to eq 'back `\` slash'
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
github_changelog_generator-1.16.4 spec/unit/generator/section_spec.rb
github_changelog_generator-1.16.3 spec/unit/generator/section_spec.rb
github_changelog_generator-1.16.2 spec/unit/generator/section_spec.rb
github_changelog_generator-1.16.1 spec/unit/generator/section_spec.rb
github_changelog_generator-1.16.0 spec/unit/generator/section_spec.rb