Sha256: c2e6ba83df693e43734487b13d5f9fc73e03640273478b8747d8c9d77dbc205f

Contents?: true

Size: 1.44 KB

Versions: 21

Compression:

Stored size: 1.44 KB

Contents

require "spec_helper"
require "octopolo/scripts/stage_up"

module Octopolo
  module Scripts
    describe StageUp do
      let(:cli) { stub(:Cli) }
      before { StageUp.any_instance.stub(:cli => cli) }

      context "#execute" do
        context "with a PR passed in via the command args" do
          subject { StageUp.new 42 }

          it "delegates the work to PullRequestMerger" do
            PullRequestMerger.should_receive(:perform).with(Git::STAGING_PREFIX, 42)
            subject.execute
          end
        end

        context "with no PR passed in from the command args" do
          subject { StageUp.new }

          context "with a PR passed in through the cli" do
            before do
              cli.should_receive(:prompt)
                 .with("Pull Request ID: ")
                 .and_return("42")
            end

            it "delegates the work to PullRequestMerger" do
              PullRequestMerger.should_receive(:perform).with(Git::STAGING_PREFIX, 42)
              subject.execute
            end
          end

          context "with no PR passed in from the cli" do
            before do
              cli.should_receive(:prompt)
                 .with("Pull Request ID: ")
                 .and_return("foo")
            end

            it "delegates the work to PullRequestMerger" do
              expect{ subject.execute }.to raise_error(ArgumentError)
            end
          end
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
octopolo-1.0.2 spec/octopolo/scripts/stage_up_spec.rb
octopolo-1.0.1 spec/octopolo/scripts/stage_up_spec.rb
octopolo-1.0.0 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.4.1 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.4.0 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.3.6 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.3.5 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.3.4 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.3.3 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.3.2 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.3.1 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.3.0 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.2.1 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.1.4 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.2.0 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.1.3 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.1.2 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.1.1 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.1.0 spec/octopolo/scripts/stage_up_spec.rb
octopolo-0.0.2 spec/octopolo/scripts/stage_up_spec.rb