diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-05-22 17:08:38 +0300 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2019-05-22 17:08:38 +0300 |
commit | bc4a18ecb9e85a5ee51541ed25b2cb9c4a2768b5 (patch) | |
tree | fdcc55def50b3436eab55a0a4c930c15c24dc795 /spec | |
parent | 744f1f2e7037f5c70c3168d9e2e89b1c327465d2 (diff) | |
parent | 37a335e60edd4f4c8b61fd2f9ffe0f1d27e3bfb8 (diff) |
Merge branch 'sh-bump-shoulda-matcher' into 'master'
Bump shoulda-matchers to 4.0.1
See merge request gitlab-org/gitlab-ce!28443
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/ci/pipeline_schedule_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/clusters/cluster_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/deployment_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/environment_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/shoulda/matchers/rails_shim.rb | 27 |
5 files changed, 7 insertions, 30 deletions
diff --git a/spec/models/ci/pipeline_schedule_spec.rb b/spec/models/ci/pipeline_schedule_spec.rb index 1bfc14d2839..42d4769a921 100644 --- a/spec/models/ci/pipeline_schedule_spec.rb +++ b/spec/models/ci/pipeline_schedule_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' describe Ci::PipelineSchedule do + subject { build(:ci_pipeline_schedule) } + it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:owner) } diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb index 60065ff22af..3ee8c340bfe 100644 --- a/spec/models/clusters/cluster_spec.rb +++ b/spec/models/clusters/cluster_spec.rb @@ -5,6 +5,8 @@ require 'spec_helper' describe Clusters::Cluster do it_behaves_like 'having unique enum values' + subject { build(:cluster) } + it { is_expected.to belong_to(:user) } it { is_expected.to have_many(:cluster_projects) } it { is_expected.to have_many(:projects) } diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb index f51322e1404..1dceef3fc00 100644 --- a/spec/models/deployment_spec.rb +++ b/spec/models/deployment_spec.rb @@ -5,8 +5,8 @@ require 'spec_helper' describe Deployment do subject { build(:deployment) } - it { is_expected.to belong_to(:project) } - it { is_expected.to belong_to(:environment) } + it { is_expected.to belong_to(:project).required } + it { is_expected.to belong_to(:environment).required } it { is_expected.to belong_to(:user) } it { is_expected.to belong_to(:deployable) } diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index 17246f238e0..7233d2454c6 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -6,7 +6,7 @@ describe Environment do let(:project) { create(:project, :stubbed_repository) } subject(:environment) { create(:environment, project: project) } - it { is_expected.to belong_to(:project) } + it { is_expected.to belong_to(:project).required } it { is_expected.to have_many(:deployments) } it { is_expected.to delegate_method(:stop_action).to(:last_deployment) } diff --git a/spec/support/shoulda/matchers/rails_shim.rb b/spec/support/shoulda/matchers/rails_shim.rb deleted file mode 100644 index 8d70598beb5..00000000000 --- a/spec/support/shoulda/matchers/rails_shim.rb +++ /dev/null @@ -1,27 +0,0 @@ -# monkey patch which fixes serialization matcher in Rails 5 -# https://github.com/thoughtbot/shoulda-matchers/issues/913 -# This can be removed when a new version of shoulda-matchers -# is released -module Shoulda - module Matchers - class RailsShim - def self.serialized_attributes_for(model) - if defined?(::ActiveRecord::Type::Serialized) - # Rails 5+ - serialized_columns = model.columns.select do |column| - model.type_for_attribute(column.name).is_a?( - ::ActiveRecord::Type::Serialized - ) - end - - serialized_columns.inject({}) do |hash, column| # rubocop:disable Style/EachWithObject - hash[column.name.to_s] = model.type_for_attribute(column.name).coder - hash - end - else - model.serialized_attributes - end - end - end - end -end |