From 1efa8f2e15664c4268f6357f2a24449c38e5047d Mon Sep 17 00:00:00 2001 From: "Z.J. van de Weg" Date: Wed, 8 Feb 2017 16:42:27 +0100 Subject: Rename issuable to IssueBase Given the the Issuable class will soon also have to support MRs this signals that it can only be used by issues. --- lib/gitlab/chat_commands/presenters/issuable.rb | 43 ---------------------- lib/gitlab/chat_commands/presenters/issue_base.rb | 43 ++++++++++++++++++++++ lib/gitlab/chat_commands/presenters/issue_new.rb | 2 +- .../chat_commands/presenters/issue_search.rb | 2 +- lib/gitlab/chat_commands/presenters/issue_show.rb | 2 +- 5 files changed, 46 insertions(+), 46 deletions(-) delete mode 100644 lib/gitlab/chat_commands/presenters/issuable.rb create mode 100644 lib/gitlab/chat_commands/presenters/issue_base.rb diff --git a/lib/gitlab/chat_commands/presenters/issuable.rb b/lib/gitlab/chat_commands/presenters/issuable.rb deleted file mode 100644 index dfb1c8f6616..00000000000 --- a/lib/gitlab/chat_commands/presenters/issuable.rb +++ /dev/null @@ -1,43 +0,0 @@ -module Gitlab - module ChatCommands - module Presenters - module Issuable - def color(issuable) - issuable.open? ? '#38ae67' : '#d22852' - end - - def status_text(issuable) - issuable.open? ? 'Open' : 'Closed' - end - - def project - @resource.project - end - - def author - @resource.author - end - - def fields - [ - { - title: "Assignee", - value: @resource.assignee ? @resource.assignee.name : "_None_", - short: true - }, - { - title: "Milestone", - value: @resource.milestone ? @resource.milestone.title : "_None_", - short: true - }, - { - title: "Labels", - value: @resource.labels.any? ? @resource.label_names : "_None_", - short: true - } - ] - end - end - end - end -end diff --git a/lib/gitlab/chat_commands/presenters/issue_base.rb b/lib/gitlab/chat_commands/presenters/issue_base.rb new file mode 100644 index 00000000000..a0058407fb2 --- /dev/null +++ b/lib/gitlab/chat_commands/presenters/issue_base.rb @@ -0,0 +1,43 @@ +module Gitlab + module ChatCommands + module Presenters + module IssueBase + def color(issuable) + issuable.open? ? '#38ae67' : '#d22852' + end + + def status_text(issuable) + issuable.open? ? 'Open' : 'Closed' + end + + def project + @resource.project + end + + def author + @resource.author + end + + def fields + [ + { + title: "Assignee", + value: @resource.assignee ? @resource.assignee.name : "_None_", + short: true + }, + { + title: "Milestone", + value: @resource.milestone ? @resource.milestone.title : "_None_", + short: true + }, + { + title: "Labels", + value: @resource.labels.any? ? @resource.label_names : "_None_", + short: true + } + ] + end + end + end + end +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? -- cgit v1.2.1 From 744df2dca8528a61e47091b2d153f087565f342c Mon Sep 17 00:00:00 2001 From: James Edwards-Jones Date: Tue, 13 Dec 2016 21:45:09 +0000 Subject: Update MergeRequest API state_event option documentation --- doc/api/merge_requests.md | 9 +++++---- lib/api/merge_requests.rb | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) 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, -- cgit v1.2.1 From fe04d920544c0234d22aa5a8c7c6793a99d3e267 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 9 Feb 2017 16:38:09 +0000 Subject: Update PROCESS.md Signed-off-by: Dmitriy Zaporozhets --- PROCESS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. -- cgit v1.2.1 From 0d9cce410dd146e512dc84fdb39bff13929a1362 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Thu, 9 Feb 2017 20:21:31 -0500 Subject: Remove a transient failure from spec/requests/api/groups_spec.rb --- spec/requests/api/groups_spec.rb | 8 +++++--- spec/support/matchers/satisfy_matchers.rb | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 spec/support/matchers/satisfy_matchers.rb 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 -- cgit v1.2.1