Sha256: 927369b1481378ec97633050a92c9cd9fd016ff369270c92d857528bb2a56e44

Contents?: true

Size: 1.83 KB

Versions: 25

Compression:

Stored size: 1.83 KB

Contents

require 'spec_helper'

describe StoryMerge do

  let(:command) { StoryMerge.new }
  before { command.stub(:story_branch).and_return('62831853-tau-manifesto') }
  subject { command }

  its(:cmd) { should match /git merge/ }

  shared_examples "story-merge with known options" do
    subject { command }
    it "should not raise an error" do
      expect { command.parse }.not_to raise_error(OptionParser::InvalidOption)
    end
  end

  describe "with no options" do
    its(:cmd) { should match /git checkout master/ }
    its(:cmd) do
      msg = Regexp.escape("[##{command.story_id}]")
      branch = command.story_branch
      should match /git merge --no-ff --log -m "#{msg}" #{branch}/
    end
  end

  describe "with the finish option" do
    let(:command) { StoryMerge.new(['-f']) }
    its(:cmd) do
      msg = Regexp.escape("[Finishes ##{command.story_id}]")
      branch = command.story_branch
      should match /git merge --no-ff --log -m "#{msg}" #{branch}/
    end
  end

  describe "with the delivers option" do
    let(:command) { StoryMerge.new(['-d']) }
    its(:cmd) do
      msg = Regexp.escape("[Delivers ##{command.story_id}]")
      branch = command.story_branch
      should match /git merge --no-ff --log -m "#{msg}" #{branch}/
    end
  end

  describe "with a custom development branch" do
    let(:command) { StoryMerge.new(['development']) }
    its(:cmd) { should match /git checkout development/ }
  end

  describe "with some unknown options" do
    let(:command) { StoryMerge.new(['development', '-o', '-a', '-z', '--foo']) }
    it_should_behave_like "story-merge with known options"
    its(:cmd) { should match /-a -z --foo/ }
  end

  describe "command-line command" do
    subject { `bin/git-story-merge --debug development` }
    it { should match /git checkout development/ }
    it { should match /git merge --no-ff --log/ }
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
pivotal-github-1.2.2 spec/commands/story_merge_spec.rb
pivotal-github-1.2.0 spec/commands/story_merge_spec.rb
pivotal-github-1.1.7 spec/commands/story_merge_spec.rb
pivotal-github-1.1.6 spec/commands/story_merge_spec.rb
pivotal-github-1.1.5 spec/commands/story_merge_spec.rb
pivotal-github-1.1.4 spec/commands/story_merge_spec.rb
pivotal-github-1.1.3 spec/commands/story_merge_spec.rb
pivotal-github-1.1.2 spec/commands/story_merge_spec.rb
pivotal-github-1.1.1 spec/commands/story_merge_spec.rb
pivotal-github-1.1.0 spec/commands/story_merge_spec.rb
pivotal-github-1.0.12 spec/commands/story_merge_spec.rb
pivotal-github-1.0.11 spec/commands/story_merge_spec.rb
pivotal-github-1.0.10 spec/commands/story_merge_spec.rb
pivotal-github-1.0.9 spec/commands/story_merge_spec.rb
pivotal-github-1.0.8 spec/commands/story_merge_spec.rb
pivotal-github-1.0.7 spec/commands/story_merge_spec.rb
pivotal-github-1.0.6 spec/commands/story_merge_spec.rb
pivotal-github-1.0.5 spec/commands/story_merge_spec.rb
pivotal-github-1.0.4 spec/commands/story_merge_spec.rb
pivotal-github-1.0.3 spec/commands/story_merge_spec.rb