Commit 37cd254c authored by Dan Davison's avatar Dan Davison

Merge branch 'refactor-project-milestone-resources' into 'master'

Refactor project milestone resources

See merge request gitlab-org/gitlab!23863
parents e4e85a10 fe0c6256
...@@ -3,12 +3,11 @@ ...@@ -3,12 +3,11 @@
module QA module QA
module EE module EE
module Resource module Resource
class ProjectMilestone < QA::Resource::Base class ProjectMilestone < QA::Resource::ProjectMilestone
attr_writer :start_date, :due_date attr_writer :start_date, :due_date
attribute :id attribute :id
attribute :iid attribute :iid
attribute :title
attribute :project do attribute :project do
QA::Resource::Project.fabricate_via_api! do |resource| QA::Resource::Project.fabricate_via_api! do |resource|
...@@ -16,24 +15,6 @@ module QA ...@@ -16,24 +15,6 @@ module QA
end end
end end
def initialize
@title = "project-milestone-#{SecureRandom.hex(8)}"
end
def resource_web_url(resource)
super
rescue ResourceURLMissingError
# this particular resource does not expose a web_url property
end
def api_get_path
"/projects/#{project.id}/milestones/#{id}"
end
def api_post_path
"/projects/#{project.id}/milestones"
end
def api_post_body def api_post_body
{ {
title: title title: title
......
...@@ -3,33 +3,14 @@ ...@@ -3,33 +3,14 @@
module QA module QA
module Resource module Resource
class ProjectMilestone < Base class ProjectMilestone < Base
attr_reader :title attribute :title
attr_accessor :description
attribute :project do attribute :project do
Project.fabricate! Project.fabricate!
end end
def title=(title) def initialize
@title = "#{title}-#{SecureRandom.hex(4)}" @title = "project-milestone-#{SecureRandom.hex(4)}"
@description = 'A milestone'
end
def fabricate!
project.visit!
Page::Project::Menu.perform do |menu|
menu.click_issues
menu.click_milestones
end
Page::Project::Milestone::Index.perform(&:click_new_milestone)
Page::Project::Milestone::New.perform do |milestone_new|
milestone_new.set_title(@title)
milestone_new.set_description(@description)
milestone_new.click_milestone_create_button
end
end end
def api_get_path def api_get_path
...@@ -42,8 +23,7 @@ module QA ...@@ -42,8 +23,7 @@ module QA
def api_post_body def api_post_body
{ {
description: @description, title: title
title: @title
} }
end end
end end
......
...@@ -32,7 +32,6 @@ module QA ...@@ -32,7 +32,6 @@ module QA
milestone = Resource::ProjectMilestone.fabricate_via_api! do |milestone| milestone = Resource::ProjectMilestone.fabricate_via_api! do |milestone|
milestone.project = @project milestone.project = @project
milestone.title = 'milestone'
end end
label = Resource::Label.fabricate_via_api! do |label| label = Resource::Label.fabricate_via_api! do |label|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment