Commit d0e26aa9 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent 06466a12
...@@ -399,7 +399,6 @@ group :test do ...@@ -399,7 +399,6 @@ group :test do
gem 'fuubar', '~> 2.2.0' gem 'fuubar', '~> 2.2.0'
gem 'rspec-retry', '~> 0.6.1' gem 'rspec-retry', '~> 0.6.1'
gem 'rspec_profiling', '~> 0.0.5' gem 'rspec_profiling', '~> 0.0.5'
gem 'rspec-set', '~> 0.1.3'
gem 'rspec-parameterized', require: false gem 'rspec-parameterized', require: false
gem 'capybara', '~> 3.22.0' gem 'capybara', '~> 3.22.0'
......
...@@ -923,7 +923,6 @@ GEM ...@@ -923,7 +923,6 @@ GEM
rspec-support (~> 3.9) rspec-support (~> 3.9)
rspec-retry (0.6.1) rspec-retry (0.6.1)
rspec-core (> 3.3) rspec-core (> 3.3)
rspec-set (0.1.3)
rspec-support (3.9.2) rspec-support (3.9.2)
rspec_junit_formatter (0.4.1) rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0) rspec-core (>= 2, < 4, != 2.12.0)
...@@ -1353,7 +1352,6 @@ DEPENDENCIES ...@@ -1353,7 +1352,6 @@ DEPENDENCIES
rspec-parameterized rspec-parameterized
rspec-rails (~> 4.0.0.beta4) rspec-rails (~> 4.0.0.beta4)
rspec-retry (~> 0.6.1) rspec-retry (~> 0.6.1)
rspec-set (~> 0.1.3)
rspec_junit_formatter rspec_junit_formatter
rspec_profiling (~> 0.0.5) rspec_profiling (~> 0.0.5)
rubocop (~> 0.74.0) rubocop (~> 0.74.0)
......
...@@ -278,26 +278,6 @@ new object. ...@@ -278,26 +278,6 @@ new object.
let_it_be(:project, refind: true) { create(:project) } 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 ### Time-sensitive tests
[Timecop](https://github.com/travisjeffery/timecop) is available in our [Timecop](https://github.com/travisjeffery/timecop) is available in our
......
...@@ -211,9 +211,7 @@ describe Gitlab::Alerting::Alert do ...@@ -211,9 +211,7 @@ describe Gitlab::Alerting::Alert do
it { is_expected.to be_valid } it { is_expected.to be_valid }
context 'without project' do context 'without project' do
# Redefine to prevent: let(:project) { nil }
# project is a NilClass - rspec-set works with ActiveRecord models only
let(:alert) { build(:alerting_alert, project: nil, payload: payload) }
it { is_expected.not_to be_valid } it { is_expected.not_to be_valid }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment