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 @@
module QA
module EE
module Resource
class ProjectMilestone < QA::Resource::Base
class ProjectMilestone < QA::Resource::ProjectMilestone
attr_writer :start_date, :due_date
attribute :id
attribute :iid
attribute :title
attribute :project do
QA::Resource::Project.fabricate_via_api! do |resource|
......@@ -16,24 +15,6 @@ module QA
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
{
title: title
......
......@@ -3,33 +3,14 @@
module QA
module Resource
class ProjectMilestone < Base
attr_reader :title
attr_accessor :description
attribute :title
attribute :project do
Project.fabricate!
end
def title=(title)
@title = "#{title}-#{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
def initialize
@title = "project-milestone-#{SecureRandom.hex(4)}"
end
def api_get_path
......@@ -42,8 +23,7 @@ module QA
def api_post_body
{
description: @description,
title: @title
title: title
}
end
end
......
......@@ -32,7 +32,6 @@ module QA
milestone = Resource::ProjectMilestone.fabricate_via_api! do |milestone|
milestone.project = @project
milestone.title = 'milestone'
end
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