Skip to content

Commit

Permalink
Adding assignees return parameter to issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ThalissonMelo committed Dec 12, 2017
1 parent b0d6183 commit d664c32
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
20 changes: 18 additions & 2 deletions app/controllers/issues_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,26 @@ def convert_form_params(issue)
@form_params = { issues_infos: [] }
if issue.kind_of?(Array)
@issues.each do |issue|
@form_params[:issues_infos].push(name: issue.title, number: issue.number, body: issue.body, issue_id: issue.id)
if issue.assignees.count > 0
assignees = []
issue.assignees.each do |assignee|
assignees.push(assignee.login)
end
@form_params[:issues_infos].push(name: issue.title, number: issue.number, body: issue.body, issue_id: issue.id, assignees: assignees)
else
@form_params[:issues_infos].push(name: issue.title, number: issue.number, body: issue.body, issue_id: issue.id, assignees: [])
end
end
else
@form_params[:issues_infos].push(name: issue.title, number: issue.number, body: issue.body, issue_id: issue.id)
if @issue.assignees.count > 0
assignees = []
issue.assignees.each do |assignee|
assignees.push(assignee.login)
end
@form_params[:issues_infos].push(name: issue.title, number: issue.number, body: issue.body, issue_id: issue.id, assignees: assignees)
else
@form_params[:issues_infos].push(name: issue.title, number: issue.number, body: issue.body, issue_id: issue.id, assignees: [])
end
end
@form_params
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/story.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Story < ApplicationRecord
belongs_to :sprint

validates :name, presence: true, length: { maximum: 128, minimum: 2 }
validates :description, length: { maximum: 256 }
validates :description, length: { maximum: 8000 }
validates :assign, length: { maximum: 32, minimum: 2 }, allow_blank: true
validates :pipeline, length: { maximum: 16, minimum: 4 }
validates :initial_date, presence: true
Expand Down
8 changes: 4 additions & 4 deletions test/controllers/issues_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def mock.get_github_user()
end

def mock.list_issues(github_slug)
[ Sawyer::Resource.new(Sawyer::Agent.new("/issues_test"), title: "issue", number: "3", body: "This is a template body") ]
[ Sawyer::Resource.new(Sawyer::Agent.new("/issues_test"), title: "issue", number: "3", body: "This is a template body", assignees: [login: "ThalissonMelo"]) ]
end


Expand Down Expand Up @@ -104,7 +104,7 @@ def mock.get_github_user()
end

def mock.create_issue(name, body)
Sawyer::Resource.new(Sawyer::Agent.new("/issues_test"), title: name, body: body, number: "3")
Sawyer::Resource.new(Sawyer::Agent.new("/issues_test"), title: name, body: body, number: "3", assignees: [login:"ThalissonMelo"])
end


Expand Down Expand Up @@ -156,7 +156,7 @@ def mock.get_github_user()
end

def mock.update_issue(name, body)
Sawyer::Resource.new(Sawyer::Agent.new("/issues_test"), title: name, body: body, number: "3")
Sawyer::Resource.new(Sawyer::Agent.new("/issues_test"), title: name, body: body, number: "3", assignees: [login: "ThalissonMelo"])
end


Expand Down Expand Up @@ -299,7 +299,7 @@ def mock.get_github_user()
end

def mock.list_issues(name)
[ Sawyer::Resource.new(Sawyer::Agent.new("/issues_test"), title: "issue", number: 9, id: 10, body: "This is a template body") ]
[ Sawyer::Resource.new(Sawyer::Agent.new("/issues_test"), title: "issue", number: 9, id: 10, body: "This is a template body", assignees:[login:"ThalissonMelo"]) ]
end


Expand Down

0 comments on commit d664c32

Please sign in to comment.