Sha256: de2112c9f2f2c3162492ecb20afd1237321ca4e91a2560d33dcd1452c729e8c1

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

# encoding: UTF-8

require 'spec_helper'

include Rosette::Core::Commands
include Rosette::DataStores

describe RequeueCommitCommand do
  let(:repo_name) { 'single_commit' }

  let(:fixture) do
    load_repo_fixture(repo_name) do |config, repo_config|
      config.use_queue('test')
      config.use_datastore('in-memory')
    end
  end

  let(:queue) { Rosette::Queuing::TestQueue::Queue }
  let(:commit_id) { fixture.repo.git('rev-parse HEAD').strip }
  let(:rosette_config) { fixture.config }
  let(:command) do
    RequeueCommitCommand.new(rosette_config)
      .set_repo_name(repo_name)
      .set_commit_id(commit_id)
  end

  describe '#execute' do
    let!(:commit_log) do
      InMemoryDataStore::CommitLog.create(
        repo_name: repo_name, commit_id: commit_id,
        status: PhraseStatus::EXTRACTED, phrase_count: 0,
        branch_name: 'refs/remotes/origin/master',
        commit_datetime: Time.now
      )
    end

    it 'enqueues the commit' do
      expect { command.execute }.to(
        change { queue.list.size }.from(0).to(1)
      )

      expect(queue.list.first.commit_id).to eq(commit_id)
      expect(commit_log.status).to eq(PhraseStatus::NOT_FOUND)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rosette-core-1.0.1 spec/core/commands/queuing/requeue_commit_command_spec.rb