summaryrefslogtreecommitdiff
path: root/spec/models/commit_status_spec.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-09-15 15:41:15 +0000
committerRémy Coutable <remy@rymai.me>2016-09-15 15:41:15 +0000
commit7b25add30f7838e1ff9726887cf90dc36406d2a1 (patch)
tree811bcc64d8dcb17931b1cc60332336091f9f3e6e /spec/models/commit_status_spec.rb
parent247ae1317492ffd36c7a120101ecb242bcdaf93e (diff)
parent2f3dc314f42dbd79813e6251792853bc231e69dd (diff)
downloadgitlab-ce-7b25add30f7838e1ff9726887cf90dc36406d2a1.tar.gz
Merge branch 'group-similar' into 'master'
Group similar builds We group builds by removing from the builds name two numbers which are delimited by whitespace or colon: * `name 0 1` => `name` * `name 0:1` => `name` * `name 0/1` => `name` * `name 0:1 ruby` => `name ruby` * `name 0/1 ruby` => `name ruby` * `0 1 name ruby` => `name ruby` * `0:1 name ruby` => `name ruby` * `0/1 name ruby` => `name ruby` See merge request !6242
Diffstat (limited to 'spec/models/commit_status_spec.rb')
-rw-r--r--spec/models/commit_status_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index 6355f636bb9..2f1baff5d66 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -223,4 +223,33 @@ describe CommitStatus, models: true do
expect(commit_status.commit).to eq project.commit
end
end
+
+ describe '#group_name' do
+ subject { commit_status.group_name }
+
+ tests = {
+ 'rspec:windows' => 'rspec:windows',
+ 'rspec:windows 0' => 'rspec:windows 0',
+ 'rspec:windows 0 test' => 'rspec:windows 0 test',
+ 'rspec:windows 0 1' => 'rspec:windows',
+ 'rspec:windows 0 1 name' => 'rspec:windows name',
+ 'rspec:windows 0/1' => 'rspec:windows',
+ 'rspec:windows 0/1 name' => 'rspec:windows name',
+ 'rspec:windows 0:1' => 'rspec:windows',
+ 'rspec:windows 0:1 name' => 'rspec:windows name',
+ 'rspec:windows 10000 20000' => 'rspec:windows',
+ 'rspec:windows 0 : / 1' => 'rspec:windows',
+ 'rspec:windows 0 : / 1 name' => 'rspec:windows name',
+ '0 1 name ruby' => 'name ruby',
+ '0 :/ 1 name ruby' => 'name ruby'
+ }
+
+ tests.each do |name, group_name|
+ it "'#{name}' puts in '#{group_name}'" do
+ commit_status.name = name
+
+ is_expected.to eq(group_name)
+ end
+ end
+ end
end