Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
converted the content change request form to capture the request context
- Loading branch information
Showing
21 changed files
with
116 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module WithRequestContext | ||
attr_accessor :request_context | ||
|
||
def self.included(base) | ||
base.validates_presence_of :request_context | ||
base.validates :request_context, :inclusion => { | ||
:in => %w(mainstream inside_government detailed_guidance other), | ||
:message => "%{value} is not valid option" | ||
} | ||
end | ||
|
||
def inside_government_related? | ||
%w{inside_government detailed_guidance}.include?(request_context) | ||
end | ||
|
||
def request_context_options | ||
[ | ||
["Mainstream GOV.UK", "mainstream"], | ||
["Inside Government", "inside_government"], | ||
["Detailed Guidance", "detailed_guidance"], | ||
["Other/Not sure", "other"] | ||
] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div id="request-context"> | ||
<%= f.input :request_context, :as => :radio, :required => true, :label => "Which part of GOV.UK is this about?", :collection => f.object.request_context_options, :input_html => {:"aria-required" => true} %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'tableless_model' | ||
require 'with_request_context' | ||
require 'test_helper' | ||
|
||
class TestModelWithRequestContext < TablelessModel | ||
include WithRequestContext | ||
end | ||
|
||
class TestModelWithRequestContextTest < Test::Unit::TestCase | ||
should validate_presence_of(:request_context) | ||
should allow_value("mainstream").for(:request_context) | ||
should allow_value("inside_government").for(:request_context) | ||
should allow_value("detailed_guidance").for(:request_context) | ||
should allow_value("other").for(:request_context) | ||
should_not allow_value("xxx").for(:request_context) | ||
|
||
should "know if it's related to inside government or not" do | ||
assert TestModelWithRequestContext.new(:request_context => "inside_government").inside_government_related? | ||
assert TestModelWithRequestContext.new(:request_context => "detailed_guidance").inside_government_related? | ||
assert !TestModelWithRequestContext.new(:request_context => "mainstream").inside_government_related? | ||
assert !TestModelWithRequestContext.new(:request_context => "other").inside_government_related? | ||
end | ||
end |
16 changes: 16 additions & 0 deletions
16
test/unit/zendesk/content_change_request_zendesk_ticket_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'test/unit' | ||
require 'shoulda/context' | ||
require 'content_change_request_zendesk_ticket' | ||
require 'ostruct' | ||
|
||
class ContentChangeRequestZendeskTicketTest < Test::Unit::TestCase | ||
def ticket_with(opts) | ||
ContentChangeRequestZendeskTicket.new(stub_everything("request", opts)) | ||
end | ||
|
||
context "an inside government request" do | ||
should "be tagged with inside_government" do | ||
assert_equal ["content_amend", "inside_government"], ticket_with(:inside_government_related? => true).tags | ||
end | ||
end | ||
end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters