summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-02-10 15:57:36 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-02-10 15:57:36 +0000
commited4b3a829a550e04ee76f894a3d7f4cfd209f683 (patch)
tree807dcdd91f4918d33de400a000b615f5a1c974ca
parentbce9f31cdbfc7c25407ace445b0bc504c3f4e2c8 (diff)
parentb88e82ff0a1bca9687b5579208ba05a99e41a464 (diff)
downloadgitlab-ce-ed4b3a829a550e04ee76f894a3d7f4cfd209f683.tar.gz
Merge branch 'master' into 27932-merge-request-pipelines-displays-json
* master: Remove a transient failure from spec/requests/api/groups_spec.rb Update PROCESS.md Update MergeRequest API state_event option documentation Rename issuable to IssueBase
-rw-r--r--PROCESS.md2
-rw-r--r--doc/api/merge_requests.md9
-rw-r--r--lib/api/merge_requests.rb2
-rw-r--r--lib/gitlab/chat_commands/presenters/issue_base.rb (renamed from lib/gitlab/chat_commands/presenters/issuable.rb)2
-rw-r--r--lib/gitlab/chat_commands/presenters/issue_new.rb2
-rw-r--r--lib/gitlab/chat_commands/presenters/issue_search.rb2
-rw-r--r--lib/gitlab/chat_commands/presenters/issue_show.rb2
-rw-r--r--spec/requests/api/groups_spec.rb8
-rw-r--r--spec/support/matchers/satisfy_matchers.rb19
9 files changed, 35 insertions, 13 deletions
diff --git a/PROCESS.md b/PROCESS.md
index f257c1d5358..fead93bd4cf 100644
--- a/PROCESS.md
+++ b/PROCESS.md
@@ -59,7 +59,7 @@ star, smile, etc.). Some good tips about code reviews can be found in our
## Feature Freeze
-On the 7th of each month, RC1 of the upcoming release is created and deployed to GitLab.com and the stable branch for this release is frozen, which means master is no longer merged into it.
+After the 7th (Pacific Standard Time Zone) of each month, RC1 of the upcoming release is created and deployed to GitLab.com and the stable branch for this release is frozen, which means master is no longer merged into it.
Merge requests may still be merged into master during this period,
but they will go into the _next_ release, unless they are manually cherry-picked into the stable branch.
By freezing the stable branches 2 weeks prior to a release, we reduce the risk of a last minute merge request potentially breaking things.
diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md
index 1cf7632d60c..6ee377125d6 100644
--- a/doc/api/merge_requests.md
+++ b/doc/api/merge_requests.md
@@ -350,16 +350,17 @@ PUT /projects/:id/merge_requests/:merge_request_id
| --------- | ---- | -------- | ----------- |
| `id` | string | yes | The ID of a project |
| `merge_request_id` | integer | yes | The ID of a merge request |
-| `source_branch` | string | yes | The source branch |
-| `target_branch` | string | yes | The target branch |
-| `title` | string | yes | Title of MR |
+| `target_branch` | string | no | The target branch |
+| `title` | string | no | Title of MR |
| `assignee_id` | integer | no | Assignee user ID |
| `description` | string | no | Description of MR |
-| `target_project_id` | integer | no | The target project (numeric id) |
+| `state_event` | string | no | New state (close/reopen) |
| `labels` | string | no | Labels for MR as a comma-separated list |
| `milestone_id` | integer | no | The ID of a milestone |
| `remove_source_branch` | boolean | no | Flag indicating if a merge request should remove the source branch when merging |
+Must include at least one non-required attribute from above.
+
```json
{
"id": 1,
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index 782147883c8..8e09a6f7354 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -138,7 +138,7 @@ module API
params do
optional :title, type: String, allow_blank: false, desc: 'The title of the merge request'
optional :target_branch, type: String, allow_blank: false, desc: 'The target branch'
- optional :state_event, type: String, values: %w[close reopen merge],
+ optional :state_event, type: String, values: %w[close reopen],
desc: 'Status of the merge request'
use :optional_params
at_least_one_of :title, :target_branch, :description, :assignee_id,
diff --git a/lib/gitlab/chat_commands/presenters/issuable.rb b/lib/gitlab/chat_commands/presenters/issue_base.rb
index dfb1c8f6616..a0058407fb2 100644
--- a/lib/gitlab/chat_commands/presenters/issuable.rb
+++ b/lib/gitlab/chat_commands/presenters/issue_base.rb
@@ -1,7 +1,7 @@
module Gitlab
module ChatCommands
module Presenters
- module Issuable
+ module IssueBase
def color(issuable)
issuable.open? ? '#38ae67' : '#d22852'
end
diff --git a/lib/gitlab/chat_commands/presenters/issue_new.rb b/lib/gitlab/chat_commands/presenters/issue_new.rb
index a1a3add56c9..0d31660039a 100644
--- a/lib/gitlab/chat_commands/presenters/issue_new.rb
+++ b/lib/gitlab/chat_commands/presenters/issue_new.rb
@@ -2,7 +2,7 @@ module Gitlab
module ChatCommands
module Presenters
class IssueNew < Presenters::Base
- include Presenters::Issuable
+ include Presenters::IssueBase
def present
in_channel_response(new_issue)
diff --git a/lib/gitlab/chat_commands/presenters/issue_search.rb b/lib/gitlab/chat_commands/presenters/issue_search.rb
index 3478359b91d..73788cf9662 100644
--- a/lib/gitlab/chat_commands/presenters/issue_search.rb
+++ b/lib/gitlab/chat_commands/presenters/issue_search.rb
@@ -2,7 +2,7 @@ module Gitlab
module ChatCommands
module Presenters
class IssueSearch < Presenters::Base
- include Presenters::Issuable
+ include Presenters::IssueBase
def present
text = if @resource.count >= 5
diff --git a/lib/gitlab/chat_commands/presenters/issue_show.rb b/lib/gitlab/chat_commands/presenters/issue_show.rb
index fe5847ccd15..bd784ad241e 100644
--- a/lib/gitlab/chat_commands/presenters/issue_show.rb
+++ b/lib/gitlab/chat_commands/presenters/issue_show.rb
@@ -2,7 +2,7 @@ module Gitlab
module ChatCommands
module Presenters
class IssueShow < Presenters::Base
- include Presenters::Issuable
+ include Presenters::IssueBase
def present
if @resource.confidential?
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb
index 15592f1f702..f78bde6f53a 100644
--- a/spec/requests/api/groups_spec.rb
+++ b/spec/requests/api/groups_spec.rb
@@ -35,7 +35,8 @@ describe API::Groups, api: true do
expect(response).to have_http_status(200)
expect(json_response).to be_an Array
expect(json_response.length).to eq(1)
- expect(json_response.first['name']).to eq(group1.name)
+ expect(json_response)
+ .to satisfy_one { |group| group['name'] == group1.name }
end
it "does not include statistics" do
@@ -70,7 +71,7 @@ describe API::Groups, api: true do
repository_size: 123,
lfs_objects_size: 234,
build_artifacts_size: 345,
- }
+ }.stringify_keys
project1.statistics.update!(attributes)
@@ -78,7 +79,8 @@ describe API::Groups, api: true do
expect(response).to have_http_status(200)
expect(json_response).to be_an Array
- expect(json_response.first['statistics']).to eq attributes.stringify_keys
+ expect(json_response)
+ .to satisfy_one { |group| group['statistics'] == attributes }
end
end
diff --git a/spec/support/matchers/satisfy_matchers.rb b/spec/support/matchers/satisfy_matchers.rb
new file mode 100644
index 00000000000..585915bac93
--- /dev/null
+++ b/spec/support/matchers/satisfy_matchers.rb
@@ -0,0 +1,19 @@
+# These matchers are a syntactic hack to provide more readable expectations for
+# an Enumerable object.
+#
+# They take advantage of the `all?`, `none?`, and `one?` methods, and the fact
+# that RSpec provides a `be_something` matcher for all predicates.
+#
+# Example:
+#
+# # Ensure exactly one object in an Array satisfies a condition
+# expect(users.one? { |u| u.admin? }).to eq true
+#
+# # The same thing, but using the `be_one` matcher
+# expect(users).to be_one { |u| u.admin? }
+#
+# # The same thing again, but using `satisfy_one` for improved readability
+# expect(users).to satisfy_one { |u| u.admin? }
+RSpec::Matchers.alias_matcher :satisfy_all, :be_all
+RSpec::Matchers.alias_matcher :satisfy_none, :be_none
+RSpec::Matchers.alias_matcher :satisfy_one, :be_one