diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-29 15:07:54 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-29 15:07:54 +0000 |
commit | d0e26aa964d15e1499c60034420b6022c5f91af9 (patch) | |
tree | e3b475265b02f0721bb1af1bbb2939c6ae81a76e | |
parent | 06466a128a06ae520ba7c8163d86407e8cdeefc5 (diff) | |
download | gitlab-ce-d0e26aa964d15e1499c60034420b6022c5f91af9.tar.gz |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | Gemfile | 1 | ||||
-rw-r--r-- | Gemfile.lock | 2 | ||||
-rw-r--r-- | doc/development/testing_guide/best_practices.md | 20 | ||||
-rw-r--r-- | spec/lib/gitlab/alerting/alert_spec.rb | 4 |
4 files changed, 1 insertions, 26 deletions
@@ -399,7 +399,6 @@ group :test do gem 'fuubar', '~> 2.2.0' gem 'rspec-retry', '~> 0.6.1' gem 'rspec_profiling', '~> 0.0.5' - gem 'rspec-set', '~> 0.1.3' gem 'rspec-parameterized', require: false gem 'capybara', '~> 3.22.0' diff --git a/Gemfile.lock b/Gemfile.lock index ecd524d3afa..a1a8f20f4c5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -923,7 +923,6 @@ GEM rspec-support (~> 3.9) rspec-retry (0.6.1) rspec-core (> 3.3) - rspec-set (0.1.3) rspec-support (3.9.2) rspec_junit_formatter (0.4.1) rspec-core (>= 2, < 4, != 2.12.0) @@ -1353,7 +1352,6 @@ DEPENDENCIES rspec-parameterized rspec-rails (~> 4.0.0.beta4) rspec-retry (~> 0.6.1) - rspec-set (~> 0.1.3) rspec_junit_formatter rspec_profiling (~> 0.0.5) rubocop (~> 0.74.0) diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md index 97ebe9bd5a7..108003b2d76 100644 --- a/doc/development/testing_guide/best_practices.md +++ b/doc/development/testing_guide/best_practices.md @@ -278,26 +278,6 @@ new object. let_it_be(:project, refind: true) { create(:project) } ``` -### `set` variables - -NOTE: **Note:** -We are incrementally removing `set` in favour of `let_it_be`. See the -[removal issue](https://gitlab.com/gitlab-org/gitlab/issues/27922). - -In some cases there is no need to recreate the same object for tests again for -each example. For example, a project is needed to test issues on the same -project, one project will do for the entire file. This can be achieved by using -`set` in the same way you would use `let`. - -`rspec-set` only works on ActiveRecord objects, and before new examples it -reloads or recreates the model, _only_ if needed. That is, when you changed -properties or destroyed the object. - -Note that you can't reference a model defined in a `let` block in a `set` block. - -Also, `set` is not supported in `:js` specs since those don't use transactions -to clean up database state after each example. - ### Time-sensitive tests [Timecop](https://github.com/travisjeffery/timecop) is available in our diff --git a/spec/lib/gitlab/alerting/alert_spec.rb b/spec/lib/gitlab/alerting/alert_spec.rb index 790edbc9c60..aaded28954e 100644 --- a/spec/lib/gitlab/alerting/alert_spec.rb +++ b/spec/lib/gitlab/alerting/alert_spec.rb @@ -211,9 +211,7 @@ describe Gitlab::Alerting::Alert do it { is_expected.to be_valid } context 'without project' do - # Redefine to prevent: - # project is a NilClass - rspec-set works with ActiveRecord models only - let(:alert) { build(:alerting_alert, project: nil, payload: payload) } + let(:project) { nil } it { is_expected.not_to be_valid } end |