Commit a90574fa authored by Robert Speicher's avatar Robert Speicher

Speed up finders/merge_requests_finder_spec

Uses the :simple merge request factory trait introduced by d166e70; cuts
execution time of this spec in half.
parent 53d3294d
require 'spec_helper' require 'spec_helper'
describe MergeRequestsFinder do describe MergeRequestsFinder do
let(:user) { create :user } let(:user) { create :user }
let(:user2) { create :user } let(:user2) { create :user }
let(:project1) { create(:project) } let(:project1) { create(:project) }
let(:project2) { create(:project) } let(:project2) { create(:project) }
let(:merge_request1) { create(:merge_request, author: user, source_project: project1, target_project: project2) }
let(:merge_request2) { create(:merge_request, author: user, source_project: project2, target_project: project1) } let!(:merge_request1) { create(:merge_request, :simple, author: user, source_project: project1, target_project: project2) }
let(:merge_request3) { create(:merge_request, author: user, source_project: project2, target_project: project2) } let!(:merge_request2) { create(:merge_request, :simple, author: user, source_project: project2, target_project: project1) }
let!(:merge_request3) { create(:merge_request, :simple, author: user, source_project: project2, target_project: project2) }
before do before do
project1.team << [user, :master] project1.team << [user, :master]
...@@ -15,13 +17,7 @@ describe MergeRequestsFinder do ...@@ -15,13 +17,7 @@ describe MergeRequestsFinder do
project2.team << [user2, :developer] project2.team << [user2, :developer]
end end
describe :execute do describe "#execute" do
before :each do
merge_request1
merge_request2
merge_request3
end
it 'should filter by scope' do it 'should filter by scope' do
params = { scope: 'authored', state: 'opened' } params = { scope: 'authored', state: 'opened' }
merge_requests = MergeRequestsFinder.new.execute(user, params) merge_requests = MergeRequestsFinder.new.execute(user, params)
......
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