Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-07 03:07:23 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-07 03:07:23 +0300
commit3462d7613fb761a4cbf2904c6980fd39b6f8bd5f (patch)
tree62d64c80f804f3cee283de4642c089d327ed61b8 /spec/finders
parentc47ade2adb94e4c33f87b4b825c92c7fe61ef044 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/environments/environments_finder_spec.rb31
1 files changed, 19 insertions, 12 deletions
diff --git a/spec/finders/environments/environments_finder_spec.rb b/spec/finders/environments/environments_finder_spec.rb
index 68c0c524478..71d10ceb5d3 100644
--- a/spec/finders/environments/environments_finder_spec.rb
+++ b/spec/finders/environments/environments_finder_spec.rb
@@ -3,9 +3,11 @@
require 'spec_helper'
RSpec.describe Environments::EnvironmentsFinder do
- let(:project) { create(:project, :repository) }
- let(:user) { project.creator }
- let(:environment) { create(:environment, :available, project: project) }
+ let_it_be(:project) { create(:project, :repository) }
+ let_it_be(:user) { project.creator }
+ let_it_be(:environment) { create(:environment, :available, project: project) }
+ let_it_be(:environment_stopped) { create(:environment, :stopped, name: 'test2', project: project) }
+ let_it_be(:environment_available) { create(:environment, :available, name: 'test3', project: project) }
before do
project.add_maintainer(user)
@@ -13,18 +15,18 @@ RSpec.describe Environments::EnvironmentsFinder do
describe '#execute' do
context 'with states parameter' do
- let(:stopped_environment) { create(:environment, :stopped, project: project) }
+ let_it_be(:stopped_environment) { create(:environment, :stopped, project: project) }
it 'returns environments with the requested state' do
result = described_class.new(project, user, states: 'available').execute
- expect(result).to contain_exactly(environment)
+ expect(result).to contain_exactly(environment, environment_available)
end
it 'returns environments with any of the requested states' do
result = described_class.new(project, user, states: %w(available stopped)).execute
- expect(result).to contain_exactly(environment, stopped_environment)
+ expect(result).to contain_exactly(environment, environment_stopped, environment_available, stopped_environment)
end
it 'raises exception when requested state is invalid' do
@@ -37,25 +39,30 @@ RSpec.describe Environments::EnvironmentsFinder do
it 'returns environments with the requested state' do
result = described_class.new(project, user, states: :available).execute
- expect(result).to contain_exactly(environment)
+ expect(result).to contain_exactly(environment, environment_available)
end
it 'returns environments with any of the requested states' do
result = described_class.new(project, user, states: [:available, :stopped]).execute
- expect(result).to contain_exactly(environment, stopped_environment)
+ expect(result).to contain_exactly(environment, environment_stopped, environment_available, stopped_environment)
end
end
end
context 'with search and states' do
- let(:environment2) { create(:environment, :stopped, name: 'test2', project: project) }
- let(:environment3) { create(:environment, :available, name: 'test3', project: project) }
-
it 'searches environments by name and state' do
result = described_class.new(project, user, search: 'test', states: :available).execute
- expect(result).to contain_exactly(environment3)
+ expect(result).to contain_exactly(environment_available)
+ end
+ end
+
+ context 'with id' do
+ it 'searches environments by name and state' do
+ result = described_class.new(project, user, search: 'test', environment_ids: [environment_available.id]).execute
+
+ expect(result).to contain_exactly(environment_available)
end
end
end