diff options
Diffstat (limited to 'spec/models/ci/resource_group_spec.rb')
-rw-r--r-- | spec/models/ci/resource_group_spec.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/models/ci/resource_group_spec.rb b/spec/models/ci/resource_group_spec.rb index 01acf5194f0..6d518d5c874 100644 --- a/spec/models/ci/resource_group_spec.rb +++ b/spec/models/ci/resource_group_spec.rb @@ -118,7 +118,7 @@ RSpec.describe Ci::ResourceGroup do let!(:resource_group) { create(:ci_resource_group, process_mode: process_mode, project: project) } - Ci::HasStatus::STATUSES_ENUM.keys.each do |status| + Ci::HasStatus::STATUSES_ENUM.keys.each do |status| # rubocop:diable RSpec/UselessDynamicDefinition let!("build_1_#{status}") { create(:ci_build, pipeline: pipeline_1, status: status, resource_group: resource_group) } let!("build_2_#{status}") { create(:ci_build, pipeline: pipeline_2, status: status, resource_group: resource_group) } end @@ -165,4 +165,23 @@ RSpec.describe Ci::ResourceGroup do end end end + + describe '#current_processable' do + subject { resource_group.current_processable } + + let(:build) { create(:ci_build) } + let(:resource_group) { create(:ci_resource_group) } + + context 'when resource is retained by a build' do + before do + resource_group.assign_resource_to(build) + end + + it { is_expected.to eq(build) } + end + + context 'when resource is not retained by a build' do + it { is_expected.to be_nil } + end + end end |