diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-12 01:47:26 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-12 01:47:26 +0300 |
commit | 1984697b35236cc57638aef2067365c25beb426f (patch) | |
tree | 2ef58ebdc37c33887cc0db82e57f3402547a1bb1 /spec/lib | |
parent | 4ccf39cde7356bf98bef5aae694257fb2c001e75 (diff) | |
parent | ded2b367ad0697765e01796f593493fc4942faeb (diff) |
Merge remote-tracking branch 'origin/master' into improve-pipeline-processing
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/changes_list_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/lib/gitlab/changes_list_spec.rb b/spec/lib/gitlab/changes_list_spec.rb new file mode 100644 index 00000000000..69d86144e32 --- /dev/null +++ b/spec/lib/gitlab/changes_list_spec.rb @@ -0,0 +1,30 @@ +require "spec_helper" + +describe Gitlab::ChangesList do + let(:valid_changes_string) { "\n000000 570e7b2 refs/heads/my_branch\nd14d6c 6fd24d refs/heads/master" } + let(:invalid_changes) { 1 } + + context 'when changes is a valid string' do + let(:changes_list) { Gitlab::ChangesList.new(valid_changes_string) } + + it 'splits elements by newline character' do + expect(changes_list).to contain_exactly({ + oldrev: "000000", + newrev: "570e7b2", + ref: "refs/heads/my_branch" + }, { + oldrev: "d14d6c", + newrev: "6fd24d", + ref: "refs/heads/master" + }) + end + + it 'behaves like a list' do + expect(changes_list.first).to eq({ + oldrev: "000000", + newrev: "570e7b2", + ref: "refs/heads/my_branch" + }) + end + end +end |