diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-10-27 01:48:26 -0300 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-10-27 20:07:11 -0300 |
commit | 0badbef83658ab2c23c7f7ea0aef81284c96c55b (patch) | |
tree | cde3c077bceee3a6d46695b5d229f8203b8662c3 /spec | |
parent | 20a7db4483904c7280093a0309a63dfd1b7ef72e (diff) | |
download | gitlab-ce-0badbef83658ab2c23c7f7ea0aef81284c96c55b.tar.gz |
Optimize Event queries by removing default order23106-events-default-scope-results-in-a-slow-query
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/projects/milestones_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/members/project_member_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/milestones/close_service_spec.rb | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/spec/controllers/projects/milestones_controller_spec.rb b/spec/controllers/projects/milestones_controller_spec.rb index 4e3ef5dc6fa..7c5f33c63b8 100644 --- a/spec/controllers/projects/milestones_controller_spec.rb +++ b/spec/controllers/projects/milestones_controller_spec.rb @@ -20,7 +20,7 @@ describe Projects::MilestonesController do delete :destroy, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid, format: :js expect(response).to be_success - expect(Event.first.action).to eq(Event::DESTROYED) + expect(Event.recent.first.action).to eq(Event::DESTROYED) expect { Milestone.find(milestone.id) }.to raise_exception(ActiveRecord::RecordNotFound) issue.reload diff --git a/spec/models/members/project_member_spec.rb b/spec/models/members/project_member_spec.rb index f6b2ec5ae31..68f72f5c86e 100644 --- a/spec/models/members/project_member_spec.rb +++ b/spec/models/members/project_member_spec.rb @@ -57,12 +57,12 @@ describe ProjectMember, models: true do it "creates an expired event when left due to expiry" do expired = create(:project_member, project: project, expires_at: Time.now - 6.days) expired.destroy - expect(Event.first.action).to eq(Event::EXPIRED) + expect(Event.recent.first.action).to eq(Event::EXPIRED) end it "creates a left event when left due to leave" do master.destroy - expect(Event.first.action).to eq(Event::LEFT) + expect(Event.recent.first.action).to eq(Event::LEFT) end it "destroys itself and delete associated todos" do diff --git a/spec/services/milestones/close_service_spec.rb b/spec/services/milestones/close_service_spec.rb index 5d400299be0..92b84308f73 100644 --- a/spec/services/milestones/close_service_spec.rb +++ b/spec/services/milestones/close_service_spec.rb @@ -18,7 +18,7 @@ describe Milestones::CloseService, services: true do it { expect(milestone).to be_closed } describe :event do - let(:event) { Event.first } + let(:event) { Event.recent.first } it { expect(event.milestone).to be_truthy } it { expect(event.target).to eq(milestone) } |