Skip to content
Browse files

Merge pull request #44 from alphagov/title_for_content_change_request

adding optional titles to content change requests
  • Loading branch information...
2 parents ab0d507 + 02731cc commit 54de464796bd39df174282bace202ef1774a9c4f @annashipman annashipman committed Jan 28, 2013
View
2 app/models/content_change/content_change_request.rb
@@ -8,7 +8,7 @@ class ContentChangeRequest < TablelessModel
include WithTimeConstraint
include WithRequestContext
- attr_accessor :details_of_change, :url, :related_urls
+ attr_accessor :title, :details_of_change, :url, :related_urls
validates_presence_of :details_of_change
def self.label
View
2 app/views/content_change_requests/_request_details.html.erb
@@ -1,5 +1,7 @@
<%= render partial: "support/request_context", locals: { f: f } %>
+<%= f.input :title, label: "Title of request", input_html: { class: "span4", placeholder: "Content change request" } %>
+
<%= f.inputs name: "URL affected" do %>
<%= f.input :url, label: "URL", input_html: { class: "span6", placeholder: "https://www.gov.uk/" } %>
View
8 features/content_change_requests.feature
@@ -10,12 +10,12 @@ Feature: Content change requests
Scenario: successful Mainstream content change request
When the user submits the following content change request:
- | Context | Details of change | URL | Related URLs | Needed by date | Not before date | Reason |
- | Mainstream (business/citizen) | Out of date XX YY | http://gov.uk/X | XXXXX | 31-12-2020 | 01-12-2020 | New law |
+ | Context | Title | Details of change | URL | Related URLs | Needed by date | Not before date | Reason |
+ | Mainstream (business/citizen) | Update X | Out of date XX YY | http://gov.uk/X | XXXXX | 31-12-2020 | 01-12-2020 | New law |
Then the following ticket is raised in ZenDesk:
- | Subject | Requester email |
- | Content change request | john.smith@email.com |
+ | Subject | Requester email |
+ | Update X - Content change request | john.smith@email.com |
And the time constraints on the ticket are:
| Need by date | Not before date |
| 31-12-2020 | 01-12-2020 |
View
1 features/step_definitions/request_steps.rb
@@ -67,6 +67,7 @@
choose @request_details["Context"]
end
+ fill_in "Title of request", :with => @request_details["Title"] unless @request_details["Title"].nil?
fill_in "Details of the requested change", :with => @request_details["Details of change"]
fill_in "URL", :with => @request_details["URL"]
fill_in "Does this affect any other URLs? (please specify one per line)", :with => @request_details["Related URLs"]
View
6 lib/content_change_request_zendesk_ticket.rb
@@ -3,7 +3,11 @@
class ContentChangeRequestZendeskTicket < ZendeskTicket
def subject
- "Content change request"
+ unless @request.title.nil? or @request.title.empty?
+ "#{@request.title} - Content change request"
+ else
+ "Content change request"
+ end
end
def tags
View
3 test/unit/models/content_change_request_test.rb
@@ -6,6 +6,9 @@ class ContentChangeRequestTest < Test::Unit::TestCase
should validate_presence_of(:request_context)
+ should allow_value("xxxx").for(:title)
+ should allow_value(nil).for(:title)
+
should allow_value("https://www.gov.uk").for(:url)
should allow_value("https://www.gov.uk/A\nhttps://www.gov.uk/A").for(:related_urls)
View
8 test/unit/zendesk/content_change_request_zendesk_ticket_test.rb
@@ -8,6 +8,14 @@ def ticket_with(opts)
ContentChangeRequestZendeskTicket.new(stub_everything("request", opts))
end
+ should "contain the title in the subject, if one is provided" do
+ assert_equal "Abc - Content change request", ticket_with(title: "Abc").subject
+ end
+
+ should "not insist on a title in the subject" do
+ assert_equal "Content change request", ticket_with({}).subject
+ end
+
context "an inside government request" do
should "be tagged with inside_government" do
tags_on_ticket = ticket_with(:inside_government_related? => true).tags

0 comments on commit 54de464

Please sign in to comment.
Something went wrong with that request. Please try again.