summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/active_session_spec.rb2
-rw-r--r--spec/models/application_setting_spec.rb7
-rw-r--r--spec/models/clusters/applications/prometheus_spec.rb6
-rw-r--r--spec/models/error_tracking/project_error_tracking_setting_spec.rb21
-rw-r--r--spec/models/merge_request_spec.rb2
-rw-r--r--spec/models/namespace_spec.rb1
-rw-r--r--spec/models/project_spec.rb1
7 files changed, 29 insertions, 11 deletions
diff --git a/spec/models/active_session_spec.rb b/spec/models/active_session_spec.rb
index 072d0fa86e5..6930f743c2f 100644
--- a/spec/models/active_session_spec.rb
+++ b/spec/models/active_session_spec.rb
@@ -139,7 +139,7 @@ RSpec.describe ActiveSession, :clean_gitlab_redis_shared_state do
redis = double(:redis)
expect(Gitlab::Redis::SharedState).to receive(:with).and_yield(redis)
- sessions = ['session-a', 'session-b']
+ sessions = %w[session-a session-b]
mget_responses = sessions.map { |session| [Marshal.dump(session)]}
expect(redis).to receive(:mget).twice.and_return(*mget_responses)
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index a403aa296d4..52e60a69a52 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -67,6 +67,13 @@ describe ApplicationSetting do
it { is_expected.not_to allow_value(nil).for(:push_event_activities_limit) }
it { is_expected.to validate_numericality_of(:snippet_size_limit).only_integer.is_greater_than(0) }
+ it { is_expected.to validate_presence_of(:max_artifacts_size) }
+ it do
+ is_expected.to validate_numericality_of(:max_pages_size).only_integer.is_greater_than(0)
+ .is_less_than(::Gitlab::Pages::MAX_SIZE / 1.megabyte)
+ end
+ it { is_expected.to validate_numericality_of(:max_artifacts_size).only_integer.is_greater_than(0) }
+ it { is_expected.to validate_numericality_of(:max_pages_size).only_integer.is_greater_than(0) }
it { is_expected.not_to allow_value(7).for(:minimum_password_length) }
it { is_expected.not_to allow_value(129).for(:minimum_password_length) }
diff --git a/spec/models/clusters/applications/prometheus_spec.rb b/spec/models/clusters/applications/prometheus_spec.rb
index 0f829e138d5..e7f5f493b82 100644
--- a/spec/models/clusters/applications/prometheus_spec.rb
+++ b/spec/models/clusters/applications/prometheus_spec.rb
@@ -130,7 +130,7 @@ describe Clusters::Applications::Prometheus do
it 'is initialized with 3 arguments' do
expect(subject.name).to eq('prometheus')
expect(subject.chart).to eq('stable/prometheus')
- expect(subject.version).to eq('6.7.3')
+ expect(subject.version).to eq('9.5.2')
expect(subject).to be_rbac
expect(subject.files).to eq(prometheus.files)
end
@@ -147,7 +147,7 @@ describe Clusters::Applications::Prometheus do
let(:prometheus) { create(:clusters_applications_prometheus, :errored, version: '2.0.0') }
it 'is initialized with the locked version' do
- expect(subject.version).to eq('6.7.3')
+ expect(subject.version).to eq('9.5.2')
end
end
@@ -218,7 +218,7 @@ describe Clusters::Applications::Prometheus do
it 'is initialized with 3 arguments' do
expect(patch_command.name).to eq('prometheus')
expect(patch_command.chart).to eq('stable/prometheus')
- expect(patch_command.version).to eq('6.7.3')
+ expect(patch_command.version).to eq('9.5.2')
expect(patch_command.files).to eq(prometheus.files)
end
end
diff --git a/spec/models/error_tracking/project_error_tracking_setting_spec.rb b/spec/models/error_tracking/project_error_tracking_setting_spec.rb
index ef426661066..5b8be7914d4 100644
--- a/spec/models/error_tracking/project_error_tracking_setting_spec.rb
+++ b/spec/models/error_tracking/project_error_tracking_setting_spec.rb
@@ -138,8 +138,6 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
error: 'error message',
error_type: ErrorTracking::ProjectErrorTrackingSetting::SENTRY_API_ERROR_TYPE_NON_20X_RESPONSE
)
- expect(subject).to have_received(:sentry_client)
- expect(sentry_client).to have_received(:list_issues)
end
end
@@ -159,8 +157,6 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
error: 'Sentry API response is missing keys. key not found: "id"',
error_type: ErrorTracking::ProjectErrorTrackingSetting::SENTRY_API_ERROR_TYPE_MISSING_KEYS
)
- expect(subject).to have_received(:sentry_client)
- expect(sentry_client).to have_received(:list_issues)
end
end
@@ -181,8 +177,21 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
error: error_msg,
error_type: ErrorTracking::ProjectErrorTrackingSetting::SENTRY_API_ERROR_INVALID_SIZE
)
- expect(subject).to have_received(:sentry_client)
- expect(sentry_client).to have_received(:list_issues)
+ end
+ end
+
+ context 'when sentry client raises StandardError' do
+ let(:sentry_client) { spy(:sentry_client) }
+
+ before do
+ synchronous_reactive_cache(subject)
+
+ allow(subject).to receive(:sentry_client).and_return(sentry_client)
+ allow(sentry_client).to receive(:list_issues).with(opts).and_raise(StandardError)
+ end
+
+ it 'returns error' do
+ expect(result).to eq(error: 'Unexpected Error')
end
end
end
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index c98d123ff52..0e151475128 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -384,7 +384,7 @@ describe MergeRequest do
end
it 'returns target branches sort by updated at desc' do
- expect(described_class.recent_target_branches).to match_array(['feature', 'merge-test', 'fix'])
+ expect(described_class.recent_target_branches).to match_array(%w[feature merge-test fix])
end
end
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index 2ba0d97792b..b732412c52c 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -26,6 +26,7 @@ describe Namespace do
it { is_expected.to validate_presence_of(:path) }
it { is_expected.to validate_length_of(:path).is_at_most(255) }
it { is_expected.to validate_presence_of(:owner) }
+ it { is_expected.to validate_numericality_of(:max_artifacts_size).only_integer.is_greater_than(0) }
it 'does not allow too deep nesting' do
ancestors = (1..21).to_a
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index e66f37f2eec..31dc0134410 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -211,6 +211,7 @@ describe Project do
it { is_expected.to validate_presence_of(:creator) }
it { is_expected.to validate_presence_of(:namespace) }
it { is_expected.to validate_presence_of(:repository_storage) }
+ it { is_expected.to validate_numericality_of(:max_artifacts_size).only_integer.is_greater_than(0) }
it 'validates build timeout constraints' do
is_expected.to validate_numericality_of(:build_timeout)