Sha256: 5d4e7fd3495c12543a78af94a604212d24cce76d3288adcb43a149611d7a78ab

Contents?: true

Size: 1.76 KB

Versions: 7

Compression:

Stored size: 1.76 KB

Contents

# frozen_string_literal: true

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

RSpec.describe Avm::Tools::Runner::Source::Issue::Complete, :git 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::Git::Launcher::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.file(Avm::Sources::Base::Configuration::CONFIGURATION_FILENAMES.first).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

7 entries across 7 versions & 1 rubygems

Version Path
eac_tools-0.94.0 sub/avm-tools/spec/lib/avm/tools/runner/source/issue/complete_spec.rb
eac_tools-0.86.5 sub/avm-tools/spec/lib/avm/tools/runner/source/issue/complete_spec.rb
eac_tools-0.86.4 sub/avm-tools/spec/lib/avm/tools/runner/source/issue/complete_spec.rb
eac_tools-0.86.3 sub/avm-tools/spec/lib/avm/tools/runner/source/issue/complete_spec.rb
eac_tools-0.86.2 sub/avm-tools/spec/lib/avm/tools/runner/source/issue/complete_spec.rb
eac_tools-0.86.1 sub/avm-tools/spec/lib/avm/tools/runner/source/issue/complete_spec.rb
eac_tools-0.86.0 sub/avm-tools/spec/lib/avm/tools/runner/source/issue/complete_spec.rb