diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-07-23 11:28:22 +0200 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-07-24 16:24:28 +0200 |
commit | 8d1e97fc3b9af28d2a34d2b16239e52d3b5d0303 (patch) | |
tree | c92a0bb3e09401c0c8e793cafc23b061d53a532e /spec/controllers | |
parent | 5e102f17f0ef16d0fd1eff98b9229fea2bc1fec9 (diff) | |
download | gitlab-ce-8d1e97fc3b9af28d2a34d2b16239e52d3b5d0303.tar.gz |
Optimise import performanceoptimise-import-performance
- Fix `O(n)` complexity of `append_or_update_attribute`,
we append objects to an array and re-save project
- Remove the usage of `keys.include?` as it performs `O(n)`
search, instead use `.has_key?`
- Remove the usage of `.keys.first` as it performs a copy
of all keys, instead use `.first.first`
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/user_callouts_controller_spec.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/controllers/user_callouts_controller_spec.rb b/spec/controllers/user_callouts_controller_spec.rb index babc93a83e5..07eaff2da09 100644 --- a/spec/controllers/user_callouts_controller_spec.rb +++ b/spec/controllers/user_callouts_controller_spec.rb @@ -13,7 +13,7 @@ describe UserCalloutsController do subject { post :create, params: { feature_name: feature_name }, format: :json } context 'with valid feature name' do - let(:feature_name) { UserCallout.feature_names.keys.first } + let(:feature_name) { UserCallout.feature_names.first.first } context 'when callout entry does not exist' do it 'creates a callout entry with dismissed state' do @@ -28,7 +28,7 @@ describe UserCalloutsController do end context 'when callout entry already exists' do - let!(:callout) { create(:user_callout, feature_name: UserCallout.feature_names.keys.first, user: user) } + let!(:callout) { create(:user_callout, feature_name: UserCallout.feature_names.first.first, user: user) } it 'returns success' do subject |