diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 511dffb..e727040 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -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 diff --git a/app/models/story.rb b/app/models/story.rb index 47fae55..94c6750 100644 --- a/app/models/story.rb +++ b/app/models/story.rb @@ -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 diff --git a/test/controllers/issues_controller_test.rb b/test/controllers/issues_controller_test.rb index 4ae69ce..f9a200b 100644 --- a/test/controllers/issues_controller_test.rb +++ b/test/controllers/issues_controller_test.rb @@ -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 @@ -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 @@ -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 @@ -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