Sha256: 146137d9238b67a6bfc8fa819bf0498cc29f4b78f8027bc27e9061c5aff10457

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'

describe Parser do

  describe "#initialize" do
    it "should take a changelog" do
      p = Parser.new('CHANGELOG')
      p.changelog.should == 'CHANGELOG'
    end
  end

  describe "#content" do
    context "when the changelog has link definitions" do
      let(:changelog) { <<-EOS
# My Awesome ChangeLog

This my awesome changelog.

<!--- The following link definition list is generated by PimpMyChangelog --->
#123: https://whatever
@pcreux: https://github.com/pcreux
EOS
      }

      it "should return the ChangeLog without the link definitions" do
        Parser.new(changelog).content.should == <<-EOS
# My Awesome ChangeLog

This my awesome changelog.

EOS
      end
    end # context "when the changelog has link definitions"

    context "when the changelog does not have link definitions" do
      let(:changelog) { "# My Awesome ChangeLog" }

      it "should return the ChangeLog without the link definitions" do
        Parser.new(changelog).content.should == changelog
      end
    end # context "when the changelog has link definitions"
  end # describe "#content"

  describe "#issues" do
    it "should return a sorted list of unique issue numbers" do
      Parser.new("#20 #100 #300 #20").issues.should == ['20', '100', '300']
    end
  end

  describe "#contributors" do
    it "should return a sorted list of unique contributors" do
      Parser.new("@samvincent @pcreux @gregbell @pcreux").contributors.
        should == ['gregbell', 'pcreux', 'samvincent']
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pimpmychangelog-0.0.2 spec/parser_spec.rb
pimpmychangelog-0.0.1 spec/parser_spec.rb