summaryrefslogtreecommitdiff
path: root/spec/factories
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2017-11-18 15:06:55 +0100
committerJacopo <beschi.jacopo@gmail.com>2017-12-13 18:02:20 +0100
commit55f322085d0507640366b7a774fe7819771ff54b (patch)
tree30fcb5e3f952fa007445342cbd67802a7f0958e3 /spec/factories
parent6930fa3102f0ba197e969f9996e86bf11346470c (diff)
downloadgitlab-ce-55f322085d0507640366b7a774fe7819771ff54b.tar.gz
Adds ordering to projects contributors in API
Allows ordering in GET api/v4/projects/:project_id/repository/contributors through `order_by` and `sort` params. The available `order_by` options are: name|email|commits. The available `sort` options are: asc|desc.
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/commits.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/factories/commits.rb b/spec/factories/commits.rb
index f4f12a095fc..4e2d8e8969e 100644
--- a/spec/factories/commits.rb
+++ b/spec/factories/commits.rb
@@ -2,15 +2,28 @@ require_relative '../support/repo_helpers'
FactoryGirl.define do
factory :commit do
- git_commit RepoHelpers.sample_commit
+ transient do
+ author nil
+ end
+
+ git_commit do
+ commit = RepoHelpers.sample_commit
+
+ if author
+ commit.author_email = author.email
+ commit.author_name = author.name
+ end
+
+ commit
+ end
project
initialize_with do
new(git_commit, project)
end
- after(:build) do |commit|
- allow(commit).to receive(:author).and_return build(:author)
+ after(:build) do |commit, evaluator|
+ allow(commit).to receive(:author).and_return(evaluator.author || build(:author))
end
trait :without_author do