diff --git a/app/controllers/admin/tags_controller.rb b/app/controllers/admin/tags_controller.rb
index 5655b0f8a..6bccb176a 100644
--- a/app/controllers/admin/tags_controller.rb
+++ b/app/controllers/admin/tags_controller.rb
@@ -4,17 +4,12 @@ class Admin::TagsController < Admin::BaseController
respond_to :html, :js
def index
- @tags = ActsAsTaggableOn::Tag.order(featured: :desc).page(params[:page])
- @tag = ActsAsTaggableOn::Tag.new
+ @tags = ActsAsTaggableOn::Tag.category.page(params[:page])
+ @tag = ActsAsTaggableOn::Tag.category.new
end
def create
- ActsAsTaggableOn::Tag.create(tag_params)
- redirect_to admin_tags_path
- end
-
- def update
- @tag.update(tag_params)
+ ActsAsTaggableOn::Tag.category.create(tag_params)
redirect_to admin_tags_path
end
@@ -26,11 +21,11 @@ class Admin::TagsController < Admin::BaseController
private
def tag_params
- params.require(:tag).permit(:featured, :name)
+ params.require(:tag).permit(:name)
end
def find_tag
- @tag = ActsAsTaggableOn::Tag.find(params[:id])
+ @tag = ActsAsTaggableOn::Tag.category.find(params[:id])
end
end
diff --git a/app/controllers/budgets/ballot/lines_controller.rb b/app/controllers/budgets/ballot/lines_controller.rb
index 25f356f1f..d5d5468a2 100644
--- a/app/controllers/budgets/ballot/lines_controller.rb
+++ b/app/controllers/budgets/ballot/lines_controller.rb
@@ -67,7 +67,7 @@ module Budgets
end
def load_categories
- @categories = ActsAsTaggableOn::Tag.where("kind = 'category'").order(:name)
+ @categories = ActsAsTaggableOn::Tag.category.order(:name)
end
def load_ballot_referer
diff --git a/app/controllers/budgets/investments_controller.rb b/app/controllers/budgets/investments_controller.rb
index ea782d47c..9ad48c1b7 100644
--- a/app/controllers/budgets/investments_controller.rb
+++ b/app/controllers/budgets/investments_controller.rb
@@ -118,7 +118,7 @@ module Budgets
end
def load_categories
- @categories = ActsAsTaggableOn::Tag.where("kind = 'category'").order(:name)
+ @categories = ActsAsTaggableOn::Tag.category.order(:name)
end
def tag_cloud
diff --git a/app/controllers/concerns/commentable_actions.rb b/app/controllers/concerns/commentable_actions.rb
index 489d1857c..195d10459 100644
--- a/app/controllers/concerns/commentable_actions.rb
+++ b/app/controllers/concerns/commentable_actions.rb
@@ -92,7 +92,7 @@ module CommentableActions
end
def load_categories
- @categories = ActsAsTaggableOn::Tag.where("kind = 'category'").order(:name)
+ @categories = ActsAsTaggableOn::Tag.category.order(:name)
end
def parse_tag_filter
diff --git a/app/controllers/management/budgets/investments_controller.rb b/app/controllers/management/budgets/investments_controller.rb
index 1fdf33911..d4ecac8d4 100644
--- a/app/controllers/management/budgets/investments_controller.rb
+++ b/app/controllers/management/budgets/investments_controller.rb
@@ -64,7 +64,7 @@ class Management::Budgets::InvestmentsController < Management::BaseController
end
def load_categories
- @categories = ActsAsTaggableOn::Tag.where("kind = 'category'").order(:name)
+ @categories = ActsAsTaggableOn::Tag.category.order(:name)
end
end
diff --git a/app/views/admin/tags/index.html.erb b/app/views/admin/tags/index.html.erb
index c1eda4b30..715479420 100644
--- a/app/views/admin/tags/index.html.erb
+++ b/app/views/admin/tags/index.html.erb
@@ -8,12 +8,6 @@
<%= f.text_field :name, placeholder: t("admin.tags.name.placeholder"), label: false %>
-
- <%= f.label :featured do %>
- <%= f.check_box :featured, title: t('admin.tags.mark_as_featured'), label: false %>
- <%= t("admin.tags.mark_as_featured") %>
- <% end %>
-
<%= f.submit(t("admin.tags.create"), class: "button success") %>
@@ -33,13 +27,8 @@
<%= tag.name %>
- <%= f.label "featured_#{tag.id}" do %>
- <%= f.check_box :featured, title: t('admin.tags.mark_as_featured'), label: false, id: "tag_featured_#{tag.id}", class: "inline-block" %>
- <%= t("admin.tags.mark_as_featured") %>
- <% end %>
- <%= f.submit(t("admin.tags.update"), class: "button hollow on-hover") %>
<%= link_to t("admin.tags.destroy"), admin_tag_path(tag), method: :delete, class: "button hollow alert on-hover" %>
<% end %>
diff --git a/config/initializers/acts_as_taggable_on.rb b/config/initializers/acts_as_taggable_on.rb
index e570e08de..57766c8c9 100644
--- a/config/initializers/acts_as_taggable_on.rb
+++ b/config/initializers/acts_as_taggable_on.rb
@@ -29,6 +29,12 @@ module ActsAsTaggableOn
Tag.class_eval do
+ scope :category, -> { where(kind: "category") }
+
+ def category?
+ kind == "category"
+ end
+
include Graphqlable
scope :public_for_api, -> do
@@ -52,7 +58,7 @@ module ActsAsTaggableOn
end
def self.category_names
- Tag.where("kind = 'category'").pluck(:name)
+ Tag.category.pluck(:name)
end
def self.spending_proposal_tags
diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml
index dd8ec1f85..9cc37b359 100755
--- a/config/locales/admin.en.yml
+++ b/config/locales/admin.en.yml
@@ -837,10 +837,8 @@ en:
index:
add_tag: Add a new proposal topic
title: Proposal topics
- mark_as_featured: Propose topic upon creating proposal
name:
placeholder: Type the name of the topic
- update: Update Topic
users:
columns:
name: Name
diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml
index 21335d418..cb852328e 100644
--- a/config/locales/admin.es.yml
+++ b/config/locales/admin.es.yml
@@ -837,10 +837,8 @@ es:
index:
add_tag: Añade un nuevo tema de propuesta
title: Temas de propuesta
- mark_as_featured: Proponer tema al crear propuesta
name:
placeholder: Escribe el nombre del tema
- update: Actualizar Tema
users:
columns:
name: Nombre
diff --git a/config/locales/admin.fr.yml b/config/locales/admin.fr.yml
index 5830488bb..2c3b84786 100644
--- a/config/locales/admin.fr.yml
+++ b/config/locales/admin.fr.yml
@@ -649,10 +649,8 @@ fr:
index:
add_tag: Ajouter un nouveau sujet de proposition
title: Sujets de propositions
- mark_as_featured: Proposer le sujet lors de la création d'une proposition
name:
placeholder: Saisir le nom du sujet
- update: Mettre-à-jour le sujet
users:
index:
filter: Filtrer
diff --git a/config/locales/admin.nl.yml b/config/locales/admin.nl.yml
index a421169f0..4e35e5ace 100755
--- a/config/locales/admin.nl.yml
+++ b/config/locales/admin.nl.yml
@@ -646,10 +646,8 @@ nl:
index:
add_tag: Add a new proposal topic
title: Proposal topics
- mark_as_featured: Propose topic upon creating proposal
name:
placeholder: Type the name of the topic
- update: Update Topic
users:
index:
filter: Filter
diff --git a/db/dev_seeds.rb b/db/dev_seeds.rb
index 42018d41d..35257931a 100644
--- a/db/dev_seeds.rb
+++ b/db/dev_seeds.rb
@@ -130,21 +130,21 @@ not_org_users = User.where(['users.id NOT IN(?)', org_user_ids])
puts " ✅"
print "Creating Tags Categories"
-ActsAsTaggableOn::Tag.create!(name: "Asociaciones", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Cultura", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Deportes", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Derechos Sociales", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Economía", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Empleo", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Equidad", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Sostenibilidad", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Participación", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Movilidad", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Medios", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Salud", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Transparencia", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Seguridad y Emergencias", featured: true, kind: "category")
-ActsAsTaggableOn::Tag.create!(name: "Medio Ambiente", featured: true, kind: "category")
+ActsAsTaggableOn::Tag.category.create!(name: "Asociaciones")
+ActsAsTaggableOn::Tag.category.create!(name: "Cultura")
+ActsAsTaggableOn::Tag.category.create!(name: "Deportes")
+ActsAsTaggableOn::Tag.category.create!(name: "Derechos Sociales")
+ActsAsTaggableOn::Tag.category.create!(name: "Economía")
+ActsAsTaggableOn::Tag.category.create!(name: "Empleo")
+ActsAsTaggableOn::Tag.category.create!(name: "Equidad")
+ActsAsTaggableOn::Tag.category.create!(name: "Sostenibilidad")
+ActsAsTaggableOn::Tag.category.create!(name: "Participación")
+ActsAsTaggableOn::Tag.category.create!(name: "Movilidad")
+ActsAsTaggableOn::Tag.category.create!(name: "Medios")
+ActsAsTaggableOn::Tag.category.create!(name: "Salud")
+ActsAsTaggableOn::Tag.category.create!(name: "Transparencia")
+ActsAsTaggableOn::Tag.category.create!(name: "Seguridad y Emergencias")
+ActsAsTaggableOn::Tag.category.create!(name: "Medio Ambiente")
puts " ✅"
print "Creating Debates"
diff --git a/db/migrate/20170623141655_remove_featured_from_tags.rb b/db/migrate/20170623141655_remove_featured_from_tags.rb
new file mode 100644
index 000000000..a819cf553
--- /dev/null
+++ b/db/migrate/20170623141655_remove_featured_from_tags.rb
@@ -0,0 +1,5 @@
+class RemoveFeaturedFromTags < ActiveRecord::Migration
+ def change
+ remove_column :tags, :featured, :boolean, default: false
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index bb73ba406..3c21882e9 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20170621180611) do
+ActiveRecord::Schema.define(version: 20170623141655) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -841,7 +841,6 @@ ActiveRecord::Schema.define(version: 20170621180611) do
create_table "tags", force: :cascade do |t|
t.string "name", limit: 40
t.integer "taggings_count", default: 0
- t.boolean "featured", default: false
t.integer "debates_count", default: 0
t.integer "proposals_count", default: 0
t.integer "spending_proposals_count", default: 0
diff --git a/spec/factories.rb b/spec/factories.rb
index 5dc19a708..8ada920b8 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -538,12 +538,8 @@ FactoryGirl.define do
factory :tag, class: 'ActsAsTaggableOn::Tag' do
sequence(:name) { |n| "Tag #{n} name" }
- trait :featured do
- featured true
- end
-
- trait :unfeatured do
- featured false
+ trait :category do
+ kind "category"
end
end
diff --git a/spec/features/admin/tags_spec.rb b/spec/features/admin/tags_spec.rb
index b944cdd9e..dd9c38c6b 100644
--- a/spec/features/admin/tags_spec.rb
+++ b/spec/features/admin/tags_spec.rb
@@ -3,12 +3,13 @@ require 'rails_helper'
feature 'Admin tags' do
background do
- @tag1 = create(:tag)
+ @tag1 = create(:tag, :category)
login_as(create(:administrator).user)
end
scenario 'Index' do
- create(:debate, tag_list: 'supertag')
+ debate = create(:debate)
+ debate.tag_list.add(create(:tag, :category, name: "supertag"))
visit admin_tags_path
expect(page).to have_content @tag1.name
@@ -30,23 +31,8 @@ feature 'Admin tags' do
expect(page).to have_content 'important issues'
end
- scenario 'Update' do
- visit admin_tags_path
- featured_checkbox = find("#tag_featured_#{@tag1.id}")
- expect(featured_checkbox.checked?).to be_blank
-
- within("#edit_tag_#{@tag1.id}") do
- check "tag_featured_#{@tag1.id}"
- click_button 'Update Topic'
- end
-
- visit admin_tags_path
- featured_checkbox = find("#tag_featured_#{@tag1.id}")
- expect(featured_checkbox.checked?).to eq(true)
- end
-
scenario 'Delete' do
- tag2 = create(:tag, name: 'bad tag')
+ tag2 = create(:tag, :category, name: "bad tag")
create(:debate, tag_list: tag2.name)
visit admin_tags_path
@@ -63,7 +49,7 @@ feature 'Admin tags' do
end
scenario 'Delete tag with hidden taggables' do
- tag2 = create(:tag, name: 'bad tag')
+ tag2 = create(:tag, :category, name: "bad tag")
debate = create(:debate, tag_list: tag2.name)
debate.hide
@@ -81,4 +67,25 @@ feature 'Admin tags' do
expect(page).to_not have_content tag2.name
end
-end
\ No newline at end of file
+ context "Manage only tags of kind category" do
+ scenario "Index shows only categories" do
+ not_category_tag = create(:tag, name: "Not a category")
+ visit admin_tags_path
+
+ expect(page).to have_content @tag1.name
+ expect(page).to_not have_content "Not a category"
+ end
+
+ scenario "Create instanciates tags of correct kind" do
+ visit admin_tags_path
+
+ within("form.new_tag") do
+ fill_in "tag_name", with: "wow_category"
+ click_button 'Create Topic'
+ end
+
+ expect(ActsAsTaggableOn::Tag.category.where(name: "wow_category")).to exist
+ end
+ end
+
+end
diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb
index 99f7cbfed..8faa899f9 100644
--- a/spec/features/proposals_spec.rb
+++ b/spec/features/proposals_spec.rb
@@ -1345,8 +1345,8 @@ feature 'Proposals' do
context "Summary" do
scenario "Displays proposals grouped by category" do
- create(:tag, kind: 'category', name: 'Culture')
- create(:tag, kind: 'category', name: 'Social Services')
+ create(:tag, :category, name: 'Culture')
+ create(:tag, :category, name: 'Social Services')
3.times { create(:proposal, tag_list: 'Culture') }
3.times { create(:proposal, tag_list: 'Social Services') }
@@ -1389,7 +1389,7 @@ feature 'Proposals' do
end
scenario "Displays a maximum of 3 proposals per category" do
- create(:tag, kind: 'category', name: 'culture')
+ create(:tag, :category, name: 'culture')
4.times { create(:proposal, tag_list: 'culture') }
visit summary_proposals_path
@@ -1398,7 +1398,7 @@ feature 'Proposals' do
end
scenario "Orders proposals by votes" do
- create(:tag, kind: 'category', name: 'culture')
+ create(:tag, :category, name: 'culture')
create(:proposal, title: 'Best', tag_list: 'culture').update_column(:confidence_score, 10)
create(:proposal, title: 'Worst', tag_list: 'culture').update_column(:confidence_score, 2)
create(:proposal, title: 'Medium', tag_list: 'culture').update_column(:confidence_score, 5)
@@ -1410,7 +1410,7 @@ feature 'Proposals' do
end
scenario "Displays proposals from last week" do
- create(:tag, kind: 'category', name: 'culture')
+ create(:tag, :category, name: 'culture')
proposal1 = create(:proposal, tag_list: 'culture', created_at: 1.day.ago)
proposal2 = create(:proposal, tag_list: 'culture', created_at: 5.days.ago)
proposal3 = create(:proposal, tag_list: 'culture', created_at: 8.days.ago)
diff --git a/spec/features/tags/budget_investments_spec.rb b/spec/features/tags/budget_investments_spec.rb
index 1269b0a21..fe1eed0e1 100644
--- a/spec/features/tags/budget_investments_spec.rb
+++ b/spec/features/tags/budget_investments_spec.rb
@@ -79,8 +79,8 @@ feature 'Tags' do
scenario 'Category with category tags', :js do
login_as(author)
- education = create(:tag, name: 'Education', kind: 'category')
- health = create(:tag, name: 'Health', kind: 'category')
+ education = create(:tag, :category, name: 'Education')
+ health = create(:tag, :category, name: 'Health')
visit new_budget_investment_path(budget_id: budget.id)
@@ -221,8 +221,8 @@ feature 'Tags' do
context "Categories" do
- let!(:tag1) { create(:tag, kind: 'category', name: 'Medio Ambiente') }
- let!(:tag2) { create(:tag, kind: 'category', name: 'Economía') }
+ let!(:tag1) { create(:tag, :category, name: 'Medio Ambiente') }
+ let!(:tag2) { create(:tag, :category, name: 'Economía') }
let!(:investment1) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') }
let!(:investment2) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') }
diff --git a/spec/features/tags/proposals_spec.rb b/spec/features/tags/proposals_spec.rb
index dbab6a95f..cf5017d4f 100644
--- a/spec/features/tags/proposals_spec.rb
+++ b/spec/features/tags/proposals_spec.rb
@@ -91,8 +91,8 @@ feature 'Tags' do
user = create(:user)
login_as(user)
- education = create(:tag, name: 'Education', kind: 'category')
- health = create(:tag, name: 'Health', kind: 'category')
+ education = create(:tag, :category, name: 'Education')
+ health = create(:tag, :category, name: 'Health')
visit new_proposal_path
@@ -265,8 +265,8 @@ feature 'Tags' do
context "Categories" do
scenario 'Display category tags' do
- create(:tag, kind: 'category', name: 'Medio Ambiente')
- create(:tag, kind: 'category', name: 'Economía')
+ create(:tag, :category, name: 'Medio Ambiente')
+ create(:tag, :category, name: 'Economía')
earth = create(:proposal, tag_list: 'Medio Ambiente')
money = create(:proposal, tag_list: 'Economía')
@@ -280,8 +280,8 @@ feature 'Tags' do
end
scenario "Filter by category tags" do
- create(:tag, kind: 'category', name: 'Medio Ambiente')
- create(:tag, kind: 'category', name: 'Economía')
+ create(:tag, :category, name: 'Medio Ambiente')
+ create(:tag, :category, name: 'Economía')
proposal1 = create(:proposal, tag_list: 'Medio Ambiente')
proposal2 = create(:proposal, tag_list: 'Medio Ambiente')
diff --git a/spec/features/tags_spec.rb b/spec/features/tags_spec.rb
index 4ca42f5eb..8497d5b63 100644
--- a/spec/features/tags_spec.rb
+++ b/spec/features/tags_spec.rb
@@ -148,8 +148,8 @@ feature 'Tags' do
end
scenario "scoped by category" do
- create(:tag, kind: 'category', name: 'Medio Ambiente')
- create(:tag, kind: 'category', name: 'Economía')
+ create(:tag, :category, name: 'Medio Ambiente')
+ create(:tag, :category, name: 'Economía')
earth = create(:proposal, tag_list: 'Medio Ambiente, Agua')
money = create(:proposal, tag_list: 'Economía, Corrupción')
diff --git a/spec/lib/acts_as_taggable_on_spec.rb b/spec/lib/acts_as_taggable_on_spec.rb
index d261bbad2..761e90553 100644
--- a/spec/lib/acts_as_taggable_on_spec.rb
+++ b/spec/lib/acts_as_taggable_on_spec.rb
@@ -77,7 +77,7 @@ describe 'ActsAsTaggableOn' do
end
it "returns tags whose kind is 'category' and have at least one tagging whose taggable is not hidden" do
- tag = create(:tag, kind: 'category')
+ tag = create(:tag, :category)
proposal = create(:proposal)
proposal.tag_list.add(tag)
proposal.save
diff --git a/spec/lib/graphql_spec.rb b/spec/lib/graphql_spec.rb
index b3b8b377f..d6ea071e2 100644
--- a/spec/lib/graphql_spec.rb
+++ b/spec/lib/graphql_spec.rb
@@ -207,7 +207,7 @@ describe 'ConsulSchema' do
it 'only retruns tags with kind nil or category' do
tag = create(:tag, name: 'Parks')
- category_tag = create(:tag, name: 'Health', kind: 'category')
+ category_tag = create(:tag, :category, name: 'Health')
admin_tag = create(:tag, name: 'Admin tag', kind: 'admin')
proposal = create(:proposal, tag_list: 'Parks, Health, Admin tag')
@@ -269,7 +269,7 @@ describe 'ConsulSchema' do
it 'only retruns tags with kind nil or category' do
tag = create(:tag, name: 'Parks')
- category_tag = create(:tag, name: 'Health', kind: 'category')
+ category_tag = create(:tag, :category, name: 'Health')
admin_tag = create(:tag, name: 'Admin tag', kind: 'admin')
debate = create(:debate, tag_list: 'Parks, Health, Admin tag')
@@ -453,7 +453,7 @@ describe 'ConsulSchema' do
describe 'Tags' do
it 'only display tags with kind nil or category' do
tag = create(:tag, name: 'Parks')
- category_tag = create(:tag, name: 'Health', kind: 'category')
+ category_tag = create(:tag, :category, name: 'Health')
admin_tag = create(:tag, name: 'Admin tag', kind: 'admin')
proposal = create(:proposal, tag_list: 'Parks')
diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb
index f60bff18c..d8c467974 100644
--- a/spec/models/proposal_spec.rb
+++ b/spec/models/proposal_spec.rb
@@ -703,14 +703,14 @@ describe Proposal do
context "categories" do
it "should return proposals tagged with a category" do
- create(:tag, kind: 'category', name: 'culture')
+ create(:tag, :category, name: 'culture')
proposal = create(:proposal, tag_list: 'culture')
expect(Proposal.for_summary.values.flatten).to include(proposal)
end
it "should not return proposals tagged without a category" do
- create(:tag, kind: 'category', name: 'culture')
+ create(:tag, :category, name: 'culture')
proposal = create(:proposal, tag_list: 'parks')
expect(Proposal.for_summary.values.flatten).to_not include(proposal)
@@ -735,19 +735,19 @@ describe Proposal do
end
it "should return proposals created this week" do
- create(:tag, kind: 'category', name: 'culture')
+ create(:tag, :category, name: 'culture')
proposal = create(:proposal, tag_list: 'culture')
expect(Proposal.for_summary.values.flatten).to include(proposal)
end
it "should not return proposals created more than a week ago" do
- create(:tag, kind: 'category', name: 'culture')
+ create(:tag, :category, name: 'culture')
proposal = create(:proposal, tag_list: 'culture', created_at: 8.days.ago)
expect(Proposal.for_summary.values.flatten).to_not include(proposal)
end
it "should order proposals by votes" do
- create(:tag, kind: 'category', name: 'culture')
+ create(:tag, :category, name: 'culture')
create(:proposal, tag_list: 'culture').update_column(:confidence_score, 2)
create(:proposal, tag_list: 'culture').update_column(:confidence_score, 10)
create(:proposal, tag_list: 'culture').update_column(:confidence_score, 5)
@@ -760,9 +760,9 @@ describe Proposal do
end
it "should order groups alphabetically" do
- create(:tag, kind: 'category', name: 'health')
- create(:tag, kind: 'category', name: 'culture')
- create(:tag, kind: 'category', name: 'social services')
+ create(:tag, :category, name: 'health')
+ create(:tag, :category, name: 'culture')
+ create(:tag, :category, name: 'social services')
health_proposal = create(:proposal, tag_list: 'health')
culture_proposal = create(:proposal, tag_list: 'culture')
@@ -776,8 +776,8 @@ describe Proposal do
end
it "should return proposals grouped by tag" do
- create(:tag, kind: 'category', name: 'culture')
- create(:tag, kind: 'category', name: 'health')
+ create(:tag, :category, name: 'culture')
+ create(:tag, :category, name: 'health')
proposal1 = create(:proposal, tag_list: 'culture')
proposal2 = create(:proposal, tag_list: 'culture')
diff --git a/spec/models/tag_cloud_spec.rb b/spec/models/tag_cloud_spec.rb
index 7b84154dc..7229b1b40 100644
--- a/spec/models/tag_cloud_spec.rb
+++ b/spec/models/tag_cloud_spec.rb
@@ -41,8 +41,8 @@ describe TagCloud do
end
it "does not return category tags" do
- create(:tag, kind: 'category', name: 'Education')
- create(:tag, kind: 'category', name: 'Participation')
+ create(:tag, :category, name: 'Education')
+ create(:tag, :category, name: 'Participation')
create(:proposal, tag_list: 'education, parks')
create(:proposal, tag_list: 'participation, water')
@@ -65,8 +65,8 @@ describe TagCloud do
end
it "returns tags scoped by category" do
- create(:tag, kind: 'category', name: 'Education')
- create(:tag, kind: 'category', name: 'Participation')
+ create(:tag, :category, name: 'Education')
+ create(:tag, :category, name: 'Participation')
create(:proposal, tag_list: 'education, parks')
create(:proposal, tag_list: 'participation, water')