aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/models/public_body_category_spec.rb38
1 files changed, 33 insertions, 5 deletions
diff --git a/spec/models/public_body_category_spec.rb b/spec/models/public_body_category_spec.rb
index 9d1105084..9ec99e395 100644
--- a/spec/models/public_body_category_spec.rb
+++ b/spec/models/public_body_category_spec.rb
@@ -18,7 +18,6 @@ describe PublicBodyCategory do
end
describe 'when asked for categories with headings' do
-
it 'should return a list of headings as plain strings, each followed by n tag specifications as
lists in the form:
["tag_to_use_as_category", "Sub category title", "Instance description"]' do
@@ -30,24 +29,53 @@ describe PublicBodyCategory do
"miscellaneous"]]
PublicBodyCategory::get().with_headings().should == expected_categories
end
-
end
describe 'when asked for headings' do
-
it 'should return a list of headings' do
PublicBodyCategory::get().headings().should == ['Local and regional', 'Miscellaneous']
end
-
end
describe 'when asked for tags by headings' do
-
it 'should return a hash of tags keyed by heading' do
PublicBodyCategory::get().by_heading().should == {'Local and regional' => ['local_council'],
'Miscellaneous' => ['other']}
end
+ end
+
+ describe 'when asked for categories with description' do
+ it 'should return a list of tag specifications as lists in the form:
+ ["tag_to_use_as_category", "Sub category title", "Instance description"]' do
+ expected_categories = [
+ ["local_council", "Local councils", "a local council"],
+ ["other", "Miscellaneous", "miscellaneous"]
+ ]
+ PublicBodyCategory::get().with_description().should == expected_categories
+ end
+ end
+
+ describe 'when asked for tags' do
+ it 'should return a list of tags' do
+ PublicBodyCategory::get().tags().should == ["local_council", "other"]
+ end
+ end
+ describe 'when asked for categories by tag' do
+ it 'should return a hash of categories keyed by tag' do
+ PublicBodyCategory::get().by_tag().should == {
+ "local_council" => "Local councils",
+ "other" => "Miscellaneous"
+ }
+ end
end
+ describe 'when asked for singular_by_tag' do
+ it 'should return a hash of category descriptions keyed by tag' do
+ PublicBodyCategory::get().singular_by_tag().should == {
+ "local_council" => "a local council",
+ "other" => "miscellaneous"
+ }
+ end
+ end
end \ No newline at end of file