Permalink
Browse files

Merge pull request #37 from alphagov/tag-short-descriptions

Tag short descriptions
  • Loading branch information...
2 parents fa6663d + 456bead commit 238f486bff06b65f774cfe3bd485af1d44d1bc92 @mnowster mnowster committed Nov 5, 2012
View
2 Gemfile
@@ -35,7 +35,7 @@ gem 'lograge'
if ENV['CONTENT_MODELS_DEV']
gem "govuk_content_models", path: '../govuk_content_models'
else
- gem "govuk_content_models", "2.0.0"
+ gem "govuk_content_models", "2.1.0"
end
if ENV['BUNDLE_DEV']
View
6 Gemfile.lock
@@ -119,11 +119,11 @@ GEM
json
gherkin (2.11.1)
json (>= 1.4.6)
- govspeak (1.2.0)
+ govspeak (1.2.2)
htmlentities (~> 4)
kramdown (~> 0.13.3)
sanitize (= 2.0.3)
- govuk_content_models (2.0.0)
+ govuk_content_models (2.1.0)
bson_ext
differ
gds-api-adapters
@@ -322,7 +322,7 @@ DEPENDENCIES
gds-sso (= 2.0.0)
gds-warmup-controller (= 0.1.0)
gelf
- govuk_content_models (= 2.0.0)
+ govuk_content_models (= 2.1.0)
launchy
less-rails-bootstrap
lograge
View
3 app/views/tags/edit.html.erb
@@ -20,9 +20,10 @@
<%= semantic_form_for(@tag, :html => { :class => '', :id => 'tag'}) do |f| %>
<%= f.inputs do %>
<%= f.input :title, :input_html => { :class => "span6" } %>
+ <%= f.input :short_description, :as => :text, :input_html => { :class => "span6", :rows => 2} %>
<%= f.input :description, :as => :text, :input_html => { :class => "span6", :rows => 6} %>
<% end %>
- <%= f.submit :value => "Save", :class => "btn btn-success" %>
+ <%= f.submit :value => "Save", :class => "btn btn-success" %>
<% end %>
</div>
</div>
View
7 features/step_definitions/category_steps.rb
@@ -32,6 +32,11 @@
click_button "Save"
end
+When /^I change the short description to "(.*?)"$/ do |short_description|
+ fill_in "Short description", with: short_description
+ click_button "Save"
+end
+
Then /^I should be on the categories page$/ do
assert_equal categories_path, page.current_url
end
@@ -44,4 +49,4 @@
Tag.where(tag_type: 'section').each do |t|
assert CuratedList.any_in(tag_ids: [t.tag_id]).first, "List for #{t.tag_id} missing"
end
-end
+end
View
8 features/tag_management.feature
@@ -13,3 +13,11 @@ Feature: Managing tags
Then I should see "Successfully updated"
And I should see "Crime, justice and superheroes"
+
+ Scenario: Updating a tag title
+ When I visit the categories page
+ And I follow the link to edit the category
+ And I change the short description to "A superhero is a fictional character who has powers which are unusual for normal people"
+
+ Then I should see "Successfully updated"
+ And I should see "A superhero is a fictional character who has powers which are unusual for normal people"
View
13 test/functional/tags_controller_test.rb
@@ -3,20 +3,22 @@
class TagsControllerTest < ActionController::TestCase
setup do
login_as_stub_user
- TagRepository.put(tag_id: "crime", title: "Crime", tag_type: "section")
+ TagRepository.put(tag_id: "crime", title: "Crime", tag_type: "section",
+ short_description: "Legal processes, courts and the police")
TagRepository.put(tag_id: "crime/the-police", title: "The Police", tag_type: "section")
@tag_count = 2
end
context "GET /tags/:id" do
should "return tag" do
- get :show, id: "crime/the-police", format: "json"
+ get :show, id: "crime", format: "json"
parsed = JSON.parse(response.body)
assert_response :success
assert_equal parsed["status"], "ok"
assert_equal parsed["tag"]["type"], "section"
- assert_equal parsed["tag"]["id"], "crime/the-police"
- assert_equal parsed["tag"]["title"], "The Police"
+ assert_equal parsed["tag"]["id"], "crime"
+ assert_equal parsed["tag"]["title"], "Crime"
+ assert_match /Legal processes, courts and the police/, parsed["tag"]["short_description"]
end
should "return 404" do
@@ -33,7 +35,6 @@ class TagsControllerTest < ActionController::TestCase
assert_equal parsed["status"], "ok"
assert_equal parsed["total"], @tag_count
assert_equal parsed["results"].count, @tag_count
-
end
end
@@ -46,6 +47,4 @@ class TagsControllerTest < ActionController::TestCase
refute parsed["results"].any? { |result| result["id"] == "minister-of-silly" }
end
end
-
-
end

0 comments on commit 238f486

Please sign in to comment.