Commit b964c6c5 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Add grouping tests

parent 8759770c
...@@ -96,7 +96,7 @@ class CommitStatus < ActiveRecord::Base ...@@ -96,7 +96,7 @@ class CommitStatus < ActiveRecord::Base
end end
def group_name def group_name
name.gsub(/\d+[\s:]+\d+\s*/, '') name.gsub(/\d+[\s:\/\\]+\d+\s*/, '').strip
end end
def self.stages def self.stages
...@@ -117,6 +117,10 @@ class CommitStatus < ActiveRecord::Base ...@@ -117,6 +117,10 @@ class CommitStatus < ActiveRecord::Base
allow_failure? && (failed? || canceled?) allow_failure? && (failed? || canceled?)
end end
def playable?
false
end
def duration def duration
calculate_duration calculate_duration
end end
......
...@@ -223,4 +223,31 @@ describe CommitStatus, models: true do ...@@ -223,4 +223,31 @@ describe CommitStatus, models: true do
expect(commit_status.commit).to eq project.commit expect(commit_status.commit).to eq project.commit
end end
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',
}
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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment