Sha256: e33a266477ada4663b08f748d1d37ba6803a4e9796a074c38a4cf5506e9fa033

Contents?: true

Size: 1.53 KB

Versions: 5

Compression:

Stored size: 1.53 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 @dash-and_underscore").contributors.
        should == ['dash-and_underscore', 'gregbell', 'pcreux', 'samvincent']
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pimpmychangelog-0.1.3 spec/parser_spec.rb
pimpmychangelog-0.1.2 spec/parser_spec.rb
pimpmychangelog-0.1.1 spec/parser_spec.rb
pimpmychangelog-0.1.0 spec/parser_spec.rb
pimpmychangelog-0.0.3 spec/parser_spec.rb