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
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-10 15:07:47 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-10 15:07:47 +0300
commit96b0c1245c93585a8b0fe23e22306d32ff4e4905 (patch)
treed2904751e1a2529e8239381ce747339cdbf5116c /spec
parent0ba3a054d2190094ffda1ebe3aa53ffc5b92247d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/ci/lints_controller_spec.rb2
-rw-r--r--spec/lib/feature_spec.rb7
-rw-r--r--spec/lib/gitlab/database_spec.rb14
-rw-r--r--spec/services/ci/create_pipeline_service_spec.rb2
-rw-r--r--spec/views/projects/ci/lints/show.html.haml_spec.rb5
5 files changed, 26 insertions, 4 deletions
diff --git a/spec/controllers/projects/ci/lints_controller_spec.rb b/spec/controllers/projects/ci/lints_controller_spec.rb
index 3d8f287f999..8fb39f734b6 100644
--- a/spec/controllers/projects/ci/lints_controller_spec.rb
+++ b/spec/controllers/projects/ci/lints_controller_spec.rb
@@ -103,7 +103,7 @@ describe Projects::Ci::LintsController do
end
it 'assigns errors' do
- expect(assigns[:error]).to eq('root config contains unknown keys: rubocop')
+ expect(assigns[:errors]).to eq(['root config contains unknown keys: rubocop'])
end
end
diff --git a/spec/lib/feature_spec.rb b/spec/lib/feature_spec.rb
index 3d59b1f35a9..2525dd17b89 100644
--- a/spec/lib/feature_spec.rb
+++ b/spec/lib/feature_spec.rb
@@ -171,6 +171,13 @@ describe Feature do
end
end
+ it 'returns the default value when the database does not exist' do
+ fake_default = double('fake default')
+ expect(ActiveRecord::Base).to receive(:connection) { raise ActiveRecord::NoDatabaseError, "No database" }
+
+ expect(described_class.enabled?(:a_feature, default_enabled: fake_default)).to eq(fake_default)
+ end
+
context 'cached feature flag', :request_store do
let(:flag) { :some_feature_flag }
diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb
index 3db8900ed8e..4a0eab3ea27 100644
--- a/spec/lib/gitlab/database_spec.rb
+++ b/spec/lib/gitlab/database_spec.rb
@@ -396,6 +396,20 @@ describe Gitlab::Database do
end
end
+ describe '.exists?' do
+ it 'returns true if `ActiveRecord::Base.connection` succeeds' do
+ expect(ActiveRecord::Base).to receive(:connection)
+
+ expect(described_class.exists?).to be(true)
+ end
+
+ it 'returns false if `ActiveRecord::Base.connection` fails' do
+ expect(ActiveRecord::Base).to receive(:connection) { raise ActiveRecord::NoDatabaseError, 'broken' }
+
+ expect(described_class.exists?).to be(false)
+ end
+ end
+
describe '#true_value' do
it 'returns correct value' do
expect(described_class.true_value).to eq "'t'"
diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb
index c4ce06d9da9..bdf4dcc3142 100644
--- a/spec/services/ci/create_pipeline_service_spec.rb
+++ b/spec/services/ci/create_pipeline_service_spec.rb
@@ -499,7 +499,7 @@ describe Ci::CreatePipelineService do
it 'pull it from Auto-DevOps' do
pipeline = execute_service
expect(pipeline).to be_auto_devops_source
- expect(pipeline.builds.map(&:name)).to eq %w[test code_quality build]
+ expect(pipeline.builds.map(&:name)).to match_array(%w[test code_quality build])
end
end
diff --git a/spec/views/projects/ci/lints/show.html.haml_spec.rb b/spec/views/projects/ci/lints/show.html.haml_spec.rb
index ea67478ff98..8c3cf04bae6 100644
--- a/spec/views/projects/ci/lints/show.html.haml_spec.rb
+++ b/spec/views/projects/ci/lints/show.html.haml_spec.rb
@@ -75,6 +75,7 @@ describe 'projects/ci/lints/show' do
it 'shows the correct values' do
render
+ expect(rendered).to have_content('Status: syntax is correct')
expect(rendered).to have_content('Tag list: dotnet')
expect(rendered).to have_content('Only policy: refs, test@dude/repo')
expect(rendered).to have_content('Except policy: refs, deploy')
@@ -87,14 +88,14 @@ describe 'projects/ci/lints/show' do
before do
assign(:project, project)
assign(:status, false)
- assign(:error, 'Undefined error')
+ assign(:errors, ['Undefined error'])
end
it 'shows error message' do
render
expect(rendered).to have_content('Status: syntax is incorrect')
- expect(rendered).to have_content('Error: Undefined error')
+ expect(rendered).to have_content('Undefined error')
expect(rendered).not_to have_content('Tag list:')
end
end