Sha256: 19306ff77899cb722d88ef2c4496292c488a1f57674ae8babee31a1427f111c9

Contents?: true

Size: 930 Bytes

Versions: 10

Compression:

Stored size: 930 Bytes

Contents

require 'commands/commands_helper'
require 'toolshed/commands/checkout_branch'

class CheckoutBranchTest < Test::Unit::TestCase
  def setup
    @branch = Toolshed::Git::Branch.new
    Toolshed.expects(:die).at_least(0).returns('die')
  end

  def test_checkout_branch
    current_branch = @branch.name

    new_branch_name = random_branch_name
    create_and_checkout_branch(new_branch_name)

    results = Toolshed::Commands::CheckoutBranch.new.execute({}, { branch_name: current_branch })
    assert_equal 'die', results
  end

  def test_checkout_branch_prompt
    current_branch = @branch.name

    new_branch_name = random_branch_name
    create_and_checkout_branch(new_branch_name)   

    # stub the possible input
    Toolshed::Commands::CheckoutBranch.any_instance.stubs(:read_user_input).returns(current_branch)

    results = Toolshed::Commands::CheckoutBranch.new.execute({})
    assert_equal 'die', results
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
toolshed-1.0.12 test/commands/checkout_branch_test.rb
toolshed-1.0.11 test/commands/checkout_branch_test.rb
toolshed-1.0.10 test/commands/checkout_branch_test.rb
toolshed-1.0.9 test/commands/checkout_branch_test.rb
toolshed-1.0.8 test/commands/checkout_branch_test.rb
toolshed-1.0.7 test/commands/checkout_branch_test.rb
toolshed-1.0.6 test/commands/checkout_branch_test.rb
toolshed-1.0.5 test/commands/checkout_branch_test.rb
toolshed-1.0.4 test/commands/checkout_branch_test.rb
toolshed-1.0.3 test/commands/checkout_branch_test.rb