Sha256: 379a80fcd8cc06518750a324ece82863445c11ee7d0f05128fc0b1c5efbba83c

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

Contents

[
  Danger::Changelog::ChangelogHeaderLine,
  Danger::Changelog::ChangelogPlaceholderLine,
  Danger::Changelog::ChangelogEntryLine
].each do |klass|
  desc = ActiveSupport::Inflector.titleize(klass.name.split(':').last).downcase

  RSpec.shared_examples "validates as #{desc}" do |line|
    describe line do
      it 'correctly' do
        expect(klass.validates_as_changelog_line?(line)).to be true
      end
    end
  end

  RSpec.shared_examples "does not validate as #{desc}" do |line|
    describe line do
      it 'correctly' do
        expect(klass.validates_as_changelog_line?(line)).to be false
      end
    end
  end

  RSpec.shared_examples "valid #{desc}" do |line|
    describe line do
      subject { klass.new(line) }
      it 'is valid' do
        expect(subject.valid?).to be true
      end
    end
  end

  RSpec.shared_examples "invalid #{desc}" do |line|
    describe line do
      subject { klass.new(line) }
      it 'is valid' do
        expect(subject.valid?).to be false
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
danger-changelog-0.7.1 spec/support/shared/changelog.rb
danger-changelog-0.7.0 spec/support/shared/changelog.rb
danger-changelog-0.6.1 spec/support/shared/changelog.rb
danger-changelog-0.6.0 spec/support/shared/changelog.rb
danger-changelog-0.5.0 spec/support/shared/changelog.rb
danger-changelog-0.4.2 spec/support/shared/changelog.rb