Sha256: 9a4c9bb2d8e642303cde1a10288837f54d65430340ada4042818cbd220ad4475

Contents?: true

Size: 1.68 KB

Versions: 4

Compression:

Stored size: 1.68 KB

Contents

# frozen_string_literal: true

require 'avm/launcher/git/base'
require 'avm/tools/runner'
require 'tmpdir'
require 'fileutils'

::RSpec.describe ::Avm::Tools::Runner::Source::Issue::Complete, git: true do
  let(:remote_name) { 'origin' }
  let(:issue_ref) { 'issue_123' }
  let(:remote_repos) { stubbed_git_local_repo(true) }
  let(:local_repos) { stubbed_git_local_repo }
  let(:eac_local_repos) { ::Avm::Launcher::Git::Base.new(local_repos.root_path.to_path) }

  context 'when branch is pushed' do
    before do
      eac_local_repos.assert_remote_url(remote_name, remote_repos.root_path.to_path)
      local_repos.command('checkout', '-b', issue_ref).execute!
      local_repos.file('myfile1.txt').touch
      local_repos.command('add', '.').execute!
      local_repos.command('commit', '-m', 'myfile1.txt').execute!
      local_repos.command('push', 'origin', issue_ref).execute!
    end

    it 'remote repos has a issue branch' do
      expect(eac_local_repos.remote_hashs(remote_name)).to include("refs/heads/#{issue_ref}")
    end

    it 'remote repos does not have a issue tag' do
      expect(eac_local_repos.remote_hashs(remote_name)).not_to include("refs/tags/#{issue_ref}")
    end

    context 'when "git issue complete" is called' do
      before do
        ::Avm::Tools::Runner.run(argv: ['source', '-C', eac_local_repos] +
            %w[issue complete --yes])
      end

      it 'remote repos does not have a issue branch' do
        expect(eac_local_repos.remote_hashs(remote_name)).not_to include("refs/heads/#{issue_ref}")
      end

      it 'remote repos has a issue tag' do
        expect(eac_local_repos.remote_hashs(remote_name)).to include("refs/tags/#{issue_ref}")
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eac_tools-0.36.0 sub/avm-tools/spec/lib/avm/tools/runner/source/issue/complete_spec.rb
eac_tools-0.35.0 sub/avm-tools/spec/lib/avm/tools/runner/source/issue/complete_spec.rb
eac_tools-0.34.0 sub/avm-tools/spec/lib/avm/tools/runner/source/issue/complete_spec.rb
eac_tools-0.33.0 sub/avm-tools/spec/lib/avm/tools/runner/source/issue/complete_spec.rb