Sha256: 65f22ff40475e7f9d31ea18e03fa796b2d911b6011323e0b619c50dda8edf194

Contents?: true

Size: 1.47 KB

Versions: 4

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'

describe StoryAccept do

  subject(:command) { StoryAccept.new(['-o']) }
  before do
    command.stub(:story_branch).and_return('62831853-tau-manifesto')
  end

  it { should respond_to(:ids_to_accept) }
  its(:git_log_delivered_story_ids) { should include "51204529" }
  its(:pivotal_tracker_delivered_story_ids) { should_not include "51204529" }

  context "with stubbed out story ids" do
    before do
      command.stub(:git_log_delivered_story_ids).
              and_return(%w[51204529 51106181 50566167 50566179 60566178])
      command.stub(:pivotal_tracker_delivered_story_ids).
              and_return(%w[51204529 51106181 50566167 50566178])
    end

    describe "ids_to_accept" do
      let(:ids) { command.ids_to_accept }
      subject { ids }

      it { should_not be_empty }
      it { should include "51204529" }
      it { should include "51106181" }
      it { should include "50566167" }
      it { should_not include "50566178" }
      it { should_not include "50566178" }
      it { should_not include "60566178" }

      it "should not have duplicate ids" do
        expect(ids).to eq ids.uniq
      end
    end


    its(:api_token) { should_not be_empty }

    describe "accept!" do
      before do
        command.stub(:accept!)
      end

      it "should accept each id" do
        number_accepted = command.ids_to_accept.length
        command.should_receive(:accept!).exactly(number_accepted).times
        command.run!
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pivotal-github-1.2.2 spec/commands/story_accept_spec.rb
pivotal-github-1.2.0 spec/commands/story_accept_spec.rb
pivotal-github-1.1.7 spec/commands/story_accept_spec.rb
pivotal-github-1.1.6 spec/commands/story_accept_spec.rb