Skip to content

Commit

Permalink
add "assign to reviewers" option and fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanxu committed Nov 10, 2021
1 parent 9ff7074 commit 935fcc7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions app/responders/ropensci/reviewers_due_date_responder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def process_message(message)

add_to_or_remove_from = [add_or_remove, to_or_from].join(" ")

if ["add to reviewers", "add as reviewer", "assign as reviewer"].include?(add_to_or_remove_from)
if ["add to reviewers", "add as reviewer", "assign as reviewer", "assign to reviewers"].include?(add_to_or_remove_from)
add_reviewer
elsif add_to_or_remove_from == "remove from reviewers"
remove_reviewer
Expand Down Expand Up @@ -153,7 +153,6 @@ def description

def example_invocation
["@#{@bot_name} assign #{params[:sample_value] || 'xxxxx'} as reviewer",
"@#{@bot_name} add #{params[:sample_value] || 'xxxxx'} to reviewers",
"@#{@bot_name} remove #{params[:sample_value] || 'xxxxx'} from reviewers"]
end
end
Expand Down
6 changes: 4 additions & 2 deletions spec/responders/ropensci/reviewers_due_date_responder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
it "should define regex" do
expect(@responder.event_regex).to match("@ropensci-review-bot add @maelle to reviewers")
expect(@responder.event_regex).to match("@ropensci-review-bot add @maelle as reviewer")
expect(@responder.event_regex).to match("@ropensci-review-bot assign @maelle as reviewer")
expect(@responder.event_regex).to match("@ropensci-review-bot assign @maelle to reviewers")
expect(@responder.event_regex).to match("@ropensci-review-bot remove @maelle from reviewers \r\n")
expect(@responder.event_regex).to_not match("@ropensci-review-bot add to reviewers")
expect(@responder.event_regex).to_not match("@ropensci-review-bot add as reviewers")
Expand Down Expand Up @@ -444,13 +446,13 @@

it "#example_invocation should use custom sample value if present" do
@responder.params = { sample_value: "@reviewer_username" }
expect(@responder.example_invocation[0]).to eq("@ropensci-review-bot add @reviewer_username to reviewers")
expect(@responder.example_invocation[0]).to eq("@ropensci-review-bot assign @reviewer_username as reviewer")
expect(@responder.example_invocation[1]).to eq("@ropensci-review-bot remove @reviewer_username from reviewers")
end

it "#example_invocation should have default sample value" do
@responder.params = {}
expect(@responder.example_invocation[0]).to eq("@ropensci-review-bot add xxxxx to reviewers")
expect(@responder.example_invocation[0]).to eq("@ropensci-review-bot assign xxxxx as reviewer")
expect(@responder.example_invocation[1]).to eq("@ropensci-review-bot remove xxxxx from reviewers")
end
end
Expand Down

0 comments on commit 935fcc7

Please sign in to comment.