PageRenderTime 46ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/test/test_stash-create-pull-request.rb

https://bitbucket.org/sqctest02/stash-command-line-tools
Ruby | 30 lines | 24 code | 6 blank | 0 comment | 0 complexity | aa11ce0643a5d246446a52a85ec29539 MD5 | raw file
  1. require 'helper'
  2. include Atlassian::Stash
  3. include Atlassian::Stash::Git
  4. class TestStashCreatePullRequest < Test::Unit::TestCase
  5. should "extract project key and repo slug from Stash remote" do
  6. remote = "https://sruiz@stash-dev.atlassian.com/scm/STASH/stash.git"
  7. cpr = CreatePullRequest.new nil
  8. ri = cpr.extract_repository_info remote
  9. assert_equal 'STASH', ri.projectKey
  10. assert_equal 'stash', ri.slug
  11. end
  12. should "extracting project key and repo slug from non stash url raises exception" do
  13. remote = "git@bitbucket.org:sebr/atlassian-stash-rubygem.git"
  14. cpr = CreatePullRequest.new nil
  15. assert_raise(RuntimeError) { cpr.extract_repository_info remote }
  16. end
  17. should "repo with hyphes" do
  18. remote = "https://sruiz@stash-dev.atlassian.com/scm/s745h/stash-repository.git"
  19. cpr = CreatePullRequest.new nil
  20. ri = cpr.extract_repository_info remote
  21. assert_equal 's745h', ri.projectKey
  22. assert_equal 'stash-repository', ri.slug
  23. end
  24. end