Sha256: e63e76b8521cbf551a8ffce5c94bc7af382fbc90f5eef297e33eeec7814cc9a5

Contents?: true

Size: 1.95 KB

Versions: 1

Compression:

Stored size: 1.95 KB

Contents

require File.expand_path('../spec_helper', __FILE__)

describe Danger::Changelog::ChangelogPlaceholderLine do
  context 'changelog line' do
    it 'validates as changelog line' do
      expect(described_class.validates_as_changelog_line?("* Your contribution here.\n")).to be true
    end

    it 'doesnt validate as changelog line' do
      expect(described_class.validates_as_changelog_line?('* Your contribution here.')).to be false
      expect(described_class.validates_as_changelog_line?("* Your contribution here\n")).to be false
      expect(described_class.validates_as_changelog_line?("* Put your contribution here.\n")).to be false
      expect(described_class.validates_as_changelog_line?("Your contribution here.\n")).to be false
    end

    context 'changelog placeholder line' do
      context 'when exactly expected string' do
        subject { Danger::Changelog::ChangelogPlaceholderLine.new("* Your contribution here.\n") }

        it 'is valid' do
          expect(subject.valid?).to be true
        end
      end

      context 'when without new line' do
        subject { Danger::Changelog::ChangelogPlaceholderLine.new('* Your contribution here.') }

        it 'is invalid' do
          expect(subject.invalid?).to be true
        end
      end

      context 'when no final period' do
        subject { Danger::Changelog::ChangelogPlaceholderLine.new("* Your contribution here\n") }

        it 'is invalid' do
          expect(subject.invalid?).to be true
        end
      end

      context 'when text doesnt match' do
        subject { Danger::Changelog::ChangelogPlaceholderLine.new("* Put your contribution here.\n") }

        it 'is invalid' do
          expect(subject.invalid?).to be true
        end
      end

      context 'when there is not star' do
        subject { Danger::Changelog::ChangelogPlaceholderLine.new("Your contribution here.\n") }

        it 'is invalid' do
          expect(subject.invalid?).to be true
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danger-changelog-0.2.1 spec/changelog_placeholder_line_spec.rb