Sha256: 1658efd1b5bf7be1b5a013febad45e308313cd550e5b9c40030a74255432d9cb

Contents?: true

Size: 1.64 KB

Versions: 2

Compression:

Stored size: 1.64 KB

Contents

describe GitHubChangelogGenerator::ParserFile do
  describe ".github_changelog_generator" do
    context "when no has file" do
      let(:options) { {} }
      let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
      subject { parse.parse! }
      it { is_expected.to be_nil }
    end

    context "when file is empty" do
      let(:options) { { params_file: "spec/files/github_changelog_params_empty" } }
      let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }

      it "does not change the options" do
        expect { parse.parse! }.to_not change { options }
      end
    end

    context "when file is incorrect" do
      let(:options) { { params_file: "spec/files/github_changelog_params_incorrect" } }
      let(:options_before_change) { options.dup }
      let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
      it { expect { parse.parse! }.to raise_error(GitHubChangelogGenerator::ParserError) }
    end

    context "when override default values" do
      let(:default_options) { GitHubChangelogGenerator::Parser.default_options }
      let(:options) { { params_file: "spec/files/github_changelog_params_override" }.merge(default_options) }
      let(:options_before_change) { options.dup }
      let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }

      it "changes the options" do
        expect { parse.parse! }.to change { options }
          .from(options_before_change)
          .to(options_before_change.merge(unreleased_label: "staging",
                                          unreleased: false,
                                          header: "=== Changelog ==="))
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
github_changelog_generator-1.10.1 spec/unit/parse_file_spec.rb
github_changelog_generator-1.10.0 spec/unit/parse_file_spec.rb