diff options
Diffstat (limited to 'spec/serializers/stage_entity_spec.rb')
-rw-r--r-- | spec/serializers/stage_entity_spec.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/serializers/stage_entity_spec.rb b/spec/serializers/stage_entity_spec.rb index 4ab40d08432..40e303f7b89 100644 --- a/spec/serializers/stage_entity_spec.rb +++ b/spec/serializers/stage_entity_spec.rb @@ -14,7 +14,7 @@ describe StageEntity do end before do - allow(request).to receive(:user).and_return(user) + allow(request).to receive(:current_user).and_return(user) create(:ci_build, :success, pipeline: pipeline) end @@ -47,5 +47,24 @@ describe StageEntity do it 'contains stage title' do expect(subject[:title]).to eq 'test: passed' end + + context 'when the jobs should be grouped' do + let(:entity) { described_class.new(stage, request: request, grouped: true) } + + it 'exposes the group key' do + expect(subject).to include :groups + end + + context 'and contains commit status' do + before do + create(:generic_commit_status, pipeline: pipeline, stage: 'test') + end + + it 'contains commit status' do + groups = subject[:groups].map { |group| group[:name] } + expect(groups).to include('generic') + end + end + end end end |