Class: CreateGithubRelease::Assertions::ReleasePrLabelExists

Inherits:
CreateGithubRelease::AssertionBase show all
Defined in:
lib/create_github_release/assertions/release_pr_label_exists.rb

Overview

Assert that the release tag does not exist in the local repository

Instance Attribute Summary

Attributes inherited from CreateGithubRelease::AssertionBase

#project

Instance Method Summary collapse

Methods inherited from CreateGithubRelease::AssertionBase

#backtick_debug?, #error, #initialize, #print, #puts

Methods included from BacktickDebug

#`

Constructor Details

This class inherits a constructor from CreateGithubRelease::AssertionBase

Instance Method Details

#assert

This method returns an undefined value.

Assert that the release pr label is defined in GitHub

Examples:

require 'create_github_release'

options = CreateGithubRelease::Options.new { |o| o.release_type = 'major', o.release_pr_label = 'release' }
assertion = CreateGithubRelease::Assertions::LastReleaseTagExists.new(options)
begin
  assertion.assert
  puts 'Assertion passed'
rescue SystemExit
  puts 'Assertion failed'
end

Raises:

  • (SystemExit)

    if the assertion fails



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/create_github_release/assertions/release_pr_label_exists.rb', line 31

def assert
  return if project.release_pr_label.nil?

  print "Checking that release pr label '#{project.release_pr_label}' exists..."

  if labels.include?(project.release_pr_label)
    puts 'OK'
  else
    error "Release pr label '#{project.release_pr_label}' does not exist"
  end
end