Skip to content

Commit

Permalink
Merge pull request #44 from alphagov/title_for_content_change_request
Browse files Browse the repository at this point in the history
adding optional titles to content change requests
  • Loading branch information
annashipman committed Jan 28, 2013
2 parents ab0d507 + 02731cc commit 54de464
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/models/content_change/content_change_request.rb
Expand Up @@ -8,7 +8,7 @@ class ContentChangeRequest < TablelessModel
include WithTimeConstraint include WithTimeConstraint
include WithRequestContext 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 validates_presence_of :details_of_change


def self.label def self.label
Expand Down
2 changes: 2 additions & 0 deletions app/views/content_change_requests/_request_details.html.erb
@@ -1,5 +1,7 @@
<%= render partial: "support/request_context", locals: { f: f } %> <%= 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.inputs name: "URL affected" do %>
<%= f.input :url, label: "URL", input_html: { class: "span6", placeholder: "https://www.gov.uk/" } %> <%= f.input :url, label: "URL", input_html: { class: "span6", placeholder: "https://www.gov.uk/" } %>
Expand Down
8 changes: 4 additions & 4 deletions features/content_change_requests.feature
Expand Up @@ -10,12 +10,12 @@ Feature: Content change requests


Scenario: successful Mainstream content change request Scenario: successful Mainstream content change request
When the user submits the following 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 | | Context | Title | 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 | | 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: Then the following ticket is raised in ZenDesk:
| Subject | Requester email | | Subject | Requester email |
| Content change request | john.smith@email.com | | Update X - Content change request | john.smith@email.com |
And the time constraints on the ticket are: And the time constraints on the ticket are:
| Need by date | Not before date | | Need by date | Not before date |
| 31-12-2020 | 01-12-2020 | | 31-12-2020 | 01-12-2020 |
Expand Down
1 change: 1 addition & 0 deletions features/step_definitions/request_steps.rb
Expand Up @@ -67,6 +67,7 @@
choose @request_details["Context"] choose @request_details["Context"]
end 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 "Details of the requested change", :with => @request_details["Details of change"]
fill_in "URL", :with => @request_details["URL"] 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"] fill_in "Does this affect any other URLs? (please specify one per line)", :with => @request_details["Related URLs"]
Expand Down
6 changes: 5 additions & 1 deletion lib/content_change_request_zendesk_ticket.rb
Expand Up @@ -3,7 +3,11 @@


class ContentChangeRequestZendeskTicket < ZendeskTicket class ContentChangeRequestZendeskTicket < ZendeskTicket
def subject def subject
"Content change request" unless @request.title.nil? or @request.title.empty?
"#{@request.title} - Content change request"
else
"Content change request"
end
end end


def tags def tags
Expand Down
3 changes: 3 additions & 0 deletions test/unit/models/content_change_request_test.rb
Expand Up @@ -6,6 +6,9 @@ class ContentChangeRequestTest < Test::Unit::TestCase


should validate_presence_of(:request_context) 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").for(:url)
should allow_value("https://www.gov.uk/A\nhttps://www.gov.uk/A").for(:related_urls) should allow_value("https://www.gov.uk/A\nhttps://www.gov.uk/A").for(:related_urls)


Expand Down
Expand Up @@ -8,6 +8,14 @@ def ticket_with(opts)
ContentChangeRequestZendeskTicket.new(stub_everything("request", opts)) ContentChangeRequestZendeskTicket.new(stub_everything("request", opts))
end 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 context "an inside government request" do
should "be tagged with inside_government" do should "be tagged with inside_government" do
tags_on_ticket = ticket_with(:inside_government_related? => true).tags tags_on_ticket = ticket_with(:inside_government_related? => true).tags
Expand Down

0 comments on commit 54de464

Please sign in to comment.