Sha256: d880f8c5253fb7c67894405a3f582c53376eba3d25578c6c2fc98379b7a248c3

Contents?: true

Size: 1.47 KB

Versions: 8

Compression:

Stored size: 1.47 KB

Contents

require_relative 'spec_helper'

describe CookbookRelease::Commit do

  let(:breaking_change) { CookbookRelease::Commit.new(subject: '[Breaking] Removed thing') }
  let(:fix_change) { CookbookRelease::Commit.new(subject: 'This is a fix') }
  let(:minor_change) { CookbookRelease::Commit.new(subject: 'This introduces a feature') }

  describe '.(major|patch|minor)?' do
    it 'detects major changes' do
      expect(breaking_change).to     be_major
      expect(fix_change)     .not_to be_major
      expect(minor_change)   .not_to be_major
    end
    it 'detects minor changes' do
      expect(breaking_change).not_to be_minor
      expect(fix_change)     .not_to be_minor
      expect(minor_change)   .to     be_minor
    end
    it 'detects patch changes' do
      expect(breaking_change).not_to be_patch
      expect(fix_change)     .to     be_patch
      expect(minor_change)   .not_to be_patch
    end
  end

  describe '.to_s_markdown' do
    it 'surrounds subject with backticks' do
      commit = CookbookRelease::Commit.new(subject: 'This is a fix', hash: 'abcdef', author: 'Linus', email: 'linus@linux.org')
      expect(commit.to_s_markdown(false)).to match(/`#{commit[:subject]}`/)
    end

    it 'properly handle emojis' do
      commit = CookbookRelease::Commit.new(subject: 'This is a fix 🔧 and I love 🪐🚀', hash: 'abcdef', author: 'Linus', email: 'linus@linux.org')
      expect(commit.to_s_markdown(false)).to match(/`This is a fix` 🔧 `and I love` 🪐🚀/)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cookbook-release-2.0.0 spec/commit_spec.rb
cookbook-release-1.9.0 spec/commit_spec.rb
cookbook-release-1.8.0 spec/commit_spec.rb
cookbook-release-1.7.0 spec/commit_spec.rb
cookbook-release-1.6.0 spec/commit_spec.rb
cookbook-release-1.5.1 spec/commit_spec.rb
cookbook-release-1.4.6 spec/commit_spec.rb
cookbook-release-1.4.5 spec/commit_spec.rb