Sha256: ea00b68860ea5339705e9dcb8bf9e7e56c690a11ca535feea3f178c39078a39d

Contents?: true

Size: 1.45 KB

Versions: 17

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

describe StoryAccept do

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

  it { should respond_to(:ids_to_accept) }

  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 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

  describe "when stopping upon reading the first accepted id" do
    let(:command) { StoryAccept.new(['-o']) }
    before do
      command.stub(:story_branch).and_return('62831853-tau-manifesto')
      command.stub(:already_accepted?).and_return(false)
      command.stub(:already_accepted?).with("50566167").and_return(true)
    end
    subject { command }

    its(:ids_to_accept) { should include("51204529") }
    its(:ids_to_accept) { should include("51106181") }
    its(:ids_to_accept) { should_not include("50566167") }
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
pivotal-github-1.1.3 spec/commands/story_accept_spec.rb
pivotal-github-1.1.2 spec/commands/story_accept_spec.rb
pivotal-github-1.1.1 spec/commands/story_accept_spec.rb
pivotal-github-1.1.0 spec/commands/story_accept_spec.rb
pivotal-github-1.0.12 spec/commands/story_accept_spec.rb
pivotal-github-1.0.11 spec/commands/story_accept_spec.rb
pivotal-github-1.0.10 spec/commands/story_accept_spec.rb
pivotal-github-1.0.9 spec/commands/story_accept_spec.rb
pivotal-github-1.0.8 spec/commands/story_accept_spec.rb
pivotal-github-1.0.7 spec/commands/story_accept_spec.rb
pivotal-github-1.0.6 spec/commands/story_accept_spec.rb
pivotal-github-1.0.5 spec/commands/story_accept_spec.rb
pivotal-github-1.0.4 spec/commands/story_accept_spec.rb
pivotal-github-1.0.3 spec/commands/story_accept_spec.rb
pivotal-github-1.0.2 spec/commands/story_accept_spec.rb
pivotal-github-1.0.1 spec/commands/story_accept_spec.rb
pivotal-github-1.0.0 spec/commands/story_accept_spec.rb