summaryrefslogtreecommitdiff
path: root/spec/names_helper_spec.rb
blob: 081dac94cb016544d530dec98a5c65904220b1c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'spec_helper'
require 'names_helper'

describe NamesHelper do
  include NamesHelper

  describe :extract_repo_name do
    it { extract_repo_name(' /opt/repos/randx/gitlab.git', '/opt/repos').should == 'randx/gitlab' }
    it { extract_repo_name("/opt/repos/randx/gitlab.git\r\n", '/opt/repos/').should == 'randx/gitlab' }
  end

  describe :extract_ref_name do
    it { extract_ref_name('refs/heads/awesome-feature').should == 'awesome-feature' }
    it { extract_ref_name('refs/tags/v2.2.1').should == 'v2.2.1' }
    it { extract_ref_name('refs/tags/releases/v2.2.1').should == 'releases/v2.2.1' }
  end
end