Merge pull request #1640 from entantoencuanto/issue#1575-tag-administration

Issue #1575 tag administration
This commit is contained in:
Raimond Garcia
2017-06-30 10:43:55 +02:00
committed by GitHub
24 changed files with 101 additions and 112 deletions

View File

@@ -4,17 +4,12 @@ class Admin::TagsController < Admin::BaseController
respond_to :html, :js respond_to :html, :js
def index def index
@tags = ActsAsTaggableOn::Tag.order(featured: :desc).page(params[:page]) @tags = ActsAsTaggableOn::Tag.category.page(params[:page])
@tag = ActsAsTaggableOn::Tag.new @tag = ActsAsTaggableOn::Tag.category.new
end end
def create def create
ActsAsTaggableOn::Tag.create(tag_params) ActsAsTaggableOn::Tag.category.create(tag_params)
redirect_to admin_tags_path
end
def update
@tag.update(tag_params)
redirect_to admin_tags_path redirect_to admin_tags_path
end end
@@ -26,11 +21,11 @@ class Admin::TagsController < Admin::BaseController
private private
def tag_params def tag_params
params.require(:tag).permit(:featured, :name) params.require(:tag).permit(:name)
end end
def find_tag def find_tag
@tag = ActsAsTaggableOn::Tag.find(params[:id]) @tag = ActsAsTaggableOn::Tag.category.find(params[:id])
end end
end end

View File

@@ -67,7 +67,7 @@ module Budgets
end end
def load_categories def load_categories
@categories = ActsAsTaggableOn::Tag.where("kind = 'category'").order(:name) @categories = ActsAsTaggableOn::Tag.category.order(:name)
end end
def load_ballot_referer def load_ballot_referer

View File

@@ -118,7 +118,7 @@ module Budgets
end end
def load_categories def load_categories
@categories = ActsAsTaggableOn::Tag.where("kind = 'category'").order(:name) @categories = ActsAsTaggableOn::Tag.category.order(:name)
end end
def tag_cloud def tag_cloud

View File

@@ -92,7 +92,7 @@ module CommentableActions
end end
def load_categories def load_categories
@categories = ActsAsTaggableOn::Tag.where("kind = 'category'").order(:name) @categories = ActsAsTaggableOn::Tag.category.order(:name)
end end
def parse_tag_filter def parse_tag_filter

View File

@@ -64,7 +64,7 @@ class Management::Budgets::InvestmentsController < Management::BaseController
end end
def load_categories def load_categories
@categories = ActsAsTaggableOn::Tag.where("kind = 'category'").order(:name) @categories = ActsAsTaggableOn::Tag.category.order(:name)
end end
end end

View File

@@ -8,12 +8,6 @@
<%= f.text_field :name, placeholder: t("admin.tags.name.placeholder"), label: false %> <%= f.text_field :name, placeholder: t("admin.tags.name.placeholder"), label: false %>
</div> </div>
<div class="is-featured small-12 medium-6 column">
<%= f.label :featured do %>
<%= f.check_box :featured, title: t('admin.tags.mark_as_featured'), label: false %>
<span class="checkbox"><%= t("admin.tags.mark_as_featured") %></span>
<% end %>
</div>
</div> </div>
<%= f.submit(t("admin.tags.create"), class: "button success") %> <%= f.submit(t("admin.tags.create"), class: "button success") %>
@@ -33,13 +27,8 @@
<span class="float-left text-left"> <span class="float-left text-left">
<strong><%= tag.name %></strong> <strong><%= tag.name %></strong>
<%= 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" %>
<span class="checkbox inline-block"><%= t("admin.tags.mark_as_featured") %></span>
<% end %>
</span> </span>
<%= 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" %> <%= link_to t("admin.tags.destroy"), admin_tag_path(tag), method: :delete, class: "button hollow alert on-hover" %>
<% end %> <% end %>
</td> </td>

View File

@@ -29,6 +29,12 @@ module ActsAsTaggableOn
Tag.class_eval do Tag.class_eval do
scope :category, -> { where(kind: "category") }
def category?
kind == "category"
end
include Graphqlable include Graphqlable
scope :public_for_api, -> do scope :public_for_api, -> do
@@ -52,7 +58,7 @@ module ActsAsTaggableOn
end end
def self.category_names def self.category_names
Tag.where("kind = 'category'").pluck(:name) Tag.category.pluck(:name)
end end
def self.spending_proposal_tags def self.spending_proposal_tags

View File

@@ -837,10 +837,8 @@ en:
index: index:
add_tag: Add a new proposal topic add_tag: Add a new proposal topic
title: Proposal topics title: Proposal topics
mark_as_featured: Propose topic upon creating proposal
name: name:
placeholder: Type the name of the topic placeholder: Type the name of the topic
update: Update Topic
users: users:
columns: columns:
name: Name name: Name

View File

@@ -837,10 +837,8 @@ es:
index: index:
add_tag: Añade un nuevo tema de propuesta add_tag: Añade un nuevo tema de propuesta
title: Temas de propuesta title: Temas de propuesta
mark_as_featured: Proponer tema al crear propuesta
name: name:
placeholder: Escribe el nombre del tema placeholder: Escribe el nombre del tema
update: Actualizar Tema
users: users:
columns: columns:
name: Nombre name: Nombre

View File

@@ -649,10 +649,8 @@ fr:
index: index:
add_tag: Ajouter un nouveau sujet de proposition add_tag: Ajouter un nouveau sujet de proposition
title: Sujets de propositions title: Sujets de propositions
mark_as_featured: Proposer le sujet lors de la création d'une proposition
name: name:
placeholder: Saisir le nom du sujet placeholder: Saisir le nom du sujet
update: Mettre-à-jour le sujet
users: users:
index: index:
filter: Filtrer filter: Filtrer

View File

@@ -646,10 +646,8 @@ nl:
index: index:
add_tag: Add a new proposal topic add_tag: Add a new proposal topic
title: Proposal topics title: Proposal topics
mark_as_featured: Propose topic upon creating proposal
name: name:
placeholder: Type the name of the topic placeholder: Type the name of the topic
update: Update Topic
users: users:
index: index:
filter: Filter filter: Filter

View File

@@ -130,21 +130,21 @@ not_org_users = User.where(['users.id NOT IN(?)', org_user_ids])
puts "" puts ""
print "Creating Tags Categories" print "Creating Tags Categories"
ActsAsTaggableOn::Tag.create!(name: "Asociaciones", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Asociaciones")
ActsAsTaggableOn::Tag.create!(name: "Cultura", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Cultura")
ActsAsTaggableOn::Tag.create!(name: "Deportes", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Deportes")
ActsAsTaggableOn::Tag.create!(name: "Derechos Sociales", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Derechos Sociales")
ActsAsTaggableOn::Tag.create!(name: "Economía", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Economía")
ActsAsTaggableOn::Tag.create!(name: "Empleo", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Empleo")
ActsAsTaggableOn::Tag.create!(name: "Equidad", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Equidad")
ActsAsTaggableOn::Tag.create!(name: "Sostenibilidad", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Sostenibilidad")
ActsAsTaggableOn::Tag.create!(name: "Participación", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Participación")
ActsAsTaggableOn::Tag.create!(name: "Movilidad", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Movilidad")
ActsAsTaggableOn::Tag.create!(name: "Medios", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Medios")
ActsAsTaggableOn::Tag.create!(name: "Salud", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Salud")
ActsAsTaggableOn::Tag.create!(name: "Transparencia", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Transparencia")
ActsAsTaggableOn::Tag.create!(name: "Seguridad y Emergencias", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Seguridad y Emergencias")
ActsAsTaggableOn::Tag.create!(name: "Medio Ambiente", featured: true, kind: "category") ActsAsTaggableOn::Tag.category.create!(name: "Medio Ambiente")
puts "" puts ""
print "Creating Debates" print "Creating Debates"

View File

@@ -0,0 +1,5 @@
class RemoveFeaturedFromTags < ActiveRecord::Migration
def change
remove_column :tags, :featured, :boolean, default: false
end
end

View File

@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # 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 # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@@ -841,7 +841,6 @@ ActiveRecord::Schema.define(version: 20170621180611) do
create_table "tags", force: :cascade do |t| create_table "tags", force: :cascade do |t|
t.string "name", limit: 40 t.string "name", limit: 40
t.integer "taggings_count", default: 0 t.integer "taggings_count", default: 0
t.boolean "featured", default: false
t.integer "debates_count", default: 0 t.integer "debates_count", default: 0
t.integer "proposals_count", default: 0 t.integer "proposals_count", default: 0
t.integer "spending_proposals_count", default: 0 t.integer "spending_proposals_count", default: 0

View File

@@ -538,12 +538,8 @@ FactoryGirl.define do
factory :tag, class: 'ActsAsTaggableOn::Tag' do factory :tag, class: 'ActsAsTaggableOn::Tag' do
sequence(:name) { |n| "Tag #{n} name" } sequence(:name) { |n| "Tag #{n} name" }
trait :featured do trait :category do
featured true kind "category"
end
trait :unfeatured do
featured false
end end
end end

View File

@@ -3,12 +3,13 @@ require 'rails_helper'
feature 'Admin tags' do feature 'Admin tags' do
background do background do
@tag1 = create(:tag) @tag1 = create(:tag, :category)
login_as(create(:administrator).user) login_as(create(:administrator).user)
end end
scenario 'Index' do scenario 'Index' do
create(:debate, tag_list: 'supertag') debate = create(:debate)
debate.tag_list.add(create(:tag, :category, name: "supertag"))
visit admin_tags_path visit admin_tags_path
expect(page).to have_content @tag1.name expect(page).to have_content @tag1.name
@@ -30,23 +31,8 @@ feature 'Admin tags' do
expect(page).to have_content 'important issues' expect(page).to have_content 'important issues'
end 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 scenario 'Delete' do
tag2 = create(:tag, name: 'bad tag') tag2 = create(:tag, :category, name: "bad tag")
create(:debate, tag_list: tag2.name) create(:debate, tag_list: tag2.name)
visit admin_tags_path visit admin_tags_path
@@ -63,7 +49,7 @@ feature 'Admin tags' do
end end
scenario 'Delete tag with hidden taggables' do 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 = create(:debate, tag_list: tag2.name)
debate.hide debate.hide
@@ -81,4 +67,25 @@ feature 'Admin tags' do
expect(page).to_not have_content tag2.name expect(page).to_not have_content tag2.name
end end
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 end

View File

@@ -1345,8 +1345,8 @@ feature 'Proposals' do
context "Summary" do context "Summary" do
scenario "Displays proposals grouped by category" do scenario "Displays proposals grouped by category" do
create(:tag, kind: 'category', name: 'Culture') create(:tag, :category, name: 'Culture')
create(:tag, kind: 'category', name: 'Social Services') create(:tag, :category, name: 'Social Services')
3.times { create(:proposal, tag_list: 'Culture') } 3.times { create(:proposal, tag_list: 'Culture') }
3.times { create(:proposal, tag_list: 'Social Services') } 3.times { create(:proposal, tag_list: 'Social Services') }
@@ -1389,7 +1389,7 @@ feature 'Proposals' do
end end
scenario "Displays a maximum of 3 proposals per category" do 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') } 4.times { create(:proposal, tag_list: 'culture') }
visit summary_proposals_path visit summary_proposals_path
@@ -1398,7 +1398,7 @@ feature 'Proposals' do
end end
scenario "Orders proposals by votes" do 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: 'Best', tag_list: 'culture').update_column(:confidence_score, 10)
create(:proposal, title: 'Worst', tag_list: 'culture').update_column(:confidence_score, 2) create(:proposal, title: 'Worst', tag_list: 'culture').update_column(:confidence_score, 2)
create(:proposal, title: 'Medium', tag_list: 'culture').update_column(:confidence_score, 5) create(:proposal, title: 'Medium', tag_list: 'culture').update_column(:confidence_score, 5)
@@ -1410,7 +1410,7 @@ feature 'Proposals' do
end end
scenario "Displays proposals from last week" do 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) proposal1 = create(:proposal, tag_list: 'culture', created_at: 1.day.ago)
proposal2 = create(:proposal, tag_list: 'culture', created_at: 5.days.ago) proposal2 = create(:proposal, tag_list: 'culture', created_at: 5.days.ago)
proposal3 = create(:proposal, tag_list: 'culture', created_at: 8.days.ago) proposal3 = create(:proposal, tag_list: 'culture', created_at: 8.days.ago)

View File

@@ -79,8 +79,8 @@ feature 'Tags' do
scenario 'Category with category tags', :js do scenario 'Category with category tags', :js do
login_as(author) login_as(author)
education = create(:tag, name: 'Education', kind: 'category') education = create(:tag, :category, name: 'Education')
health = create(:tag, name: 'Health', kind: 'category') health = create(:tag, :category, name: 'Health')
visit new_budget_investment_path(budget_id: budget.id) visit new_budget_investment_path(budget_id: budget.id)
@@ -221,8 +221,8 @@ feature 'Tags' do
context "Categories" do context "Categories" do
let!(:tag1) { create(:tag, kind: 'category', name: 'Medio Ambiente') } let!(:tag1) { create(:tag, :category, name: 'Medio Ambiente') }
let!(:tag2) { create(:tag, kind: 'category', name: 'Economía') } let!(:tag2) { create(:tag, :category, name: 'Economía') }
let!(:investment1) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') } let!(:investment1) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') }
let!(:investment2) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') } let!(:investment2) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') }

View File

@@ -91,8 +91,8 @@ feature 'Tags' do
user = create(:user) user = create(:user)
login_as(user) login_as(user)
education = create(:tag, name: 'Education', kind: 'category') education = create(:tag, :category, name: 'Education')
health = create(:tag, name: 'Health', kind: 'category') health = create(:tag, :category, name: 'Health')
visit new_proposal_path visit new_proposal_path
@@ -265,8 +265,8 @@ feature 'Tags' do
context "Categories" do context "Categories" do
scenario 'Display category tags' do scenario 'Display category tags' do
create(:tag, kind: 'category', name: 'Medio Ambiente') create(:tag, :category, name: 'Medio Ambiente')
create(:tag, kind: 'category', name: 'Economía') create(:tag, :category, name: 'Economía')
earth = create(:proposal, tag_list: 'Medio Ambiente') earth = create(:proposal, tag_list: 'Medio Ambiente')
money = create(:proposal, tag_list: 'Economía') money = create(:proposal, tag_list: 'Economía')
@@ -280,8 +280,8 @@ feature 'Tags' do
end end
scenario "Filter by category tags" do scenario "Filter by category tags" do
create(:tag, kind: 'category', name: 'Medio Ambiente') create(:tag, :category, name: 'Medio Ambiente')
create(:tag, kind: 'category', name: 'Economía') create(:tag, :category, name: 'Economía')
proposal1 = create(:proposal, tag_list: 'Medio Ambiente') proposal1 = create(:proposal, tag_list: 'Medio Ambiente')
proposal2 = create(:proposal, tag_list: 'Medio Ambiente') proposal2 = create(:proposal, tag_list: 'Medio Ambiente')

View File

@@ -148,8 +148,8 @@ feature 'Tags' do
end end
scenario "scoped by category" do scenario "scoped by category" do
create(:tag, kind: 'category', name: 'Medio Ambiente') create(:tag, :category, name: 'Medio Ambiente')
create(:tag, kind: 'category', name: 'Economía') create(:tag, :category, name: 'Economía')
earth = create(:proposal, tag_list: 'Medio Ambiente, Agua') earth = create(:proposal, tag_list: 'Medio Ambiente, Agua')
money = create(:proposal, tag_list: 'Economía, Corrupción') money = create(:proposal, tag_list: 'Economía, Corrupción')

View File

@@ -77,7 +77,7 @@ describe 'ActsAsTaggableOn' do
end end
it "returns tags whose kind is 'category' and have at least one tagging whose taggable is not hidden" do 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 = create(:proposal)
proposal.tag_list.add(tag) proposal.tag_list.add(tag)
proposal.save proposal.save

View File

@@ -207,7 +207,7 @@ describe 'ConsulSchema' do
it 'only retruns tags with kind nil or category' do it 'only retruns tags with kind nil or category' do
tag = create(:tag, name: 'Parks') 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') admin_tag = create(:tag, name: 'Admin tag', kind: 'admin')
proposal = create(:proposal, tag_list: 'Parks, Health, Admin tag') 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 it 'only retruns tags with kind nil or category' do
tag = create(:tag, name: 'Parks') 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') admin_tag = create(:tag, name: 'Admin tag', kind: 'admin')
debate = create(:debate, tag_list: 'Parks, Health, Admin tag') debate = create(:debate, tag_list: 'Parks, Health, Admin tag')
@@ -453,7 +453,7 @@ describe 'ConsulSchema' do
describe 'Tags' do describe 'Tags' do
it 'only display tags with kind nil or category' do it 'only display tags with kind nil or category' do
tag = create(:tag, name: 'Parks') 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') admin_tag = create(:tag, name: 'Admin tag', kind: 'admin')
proposal = create(:proposal, tag_list: 'Parks') proposal = create(:proposal, tag_list: 'Parks')

View File

@@ -703,14 +703,14 @@ describe Proposal do
context "categories" do context "categories" do
it "should return proposals tagged with a category" 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') proposal = create(:proposal, tag_list: 'culture')
expect(Proposal.for_summary.values.flatten).to include(proposal) expect(Proposal.for_summary.values.flatten).to include(proposal)
end end
it "should not return proposals tagged without a category" do 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') proposal = create(:proposal, tag_list: 'parks')
expect(Proposal.for_summary.values.flatten).to_not include(proposal) expect(Proposal.for_summary.values.flatten).to_not include(proposal)
@@ -735,19 +735,19 @@ describe Proposal do
end end
it "should return proposals created this week" do 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') proposal = create(:proposal, tag_list: 'culture')
expect(Proposal.for_summary.values.flatten).to include(proposal) expect(Proposal.for_summary.values.flatten).to include(proposal)
end end
it "should not return proposals created more than a week ago" do 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) proposal = create(:proposal, tag_list: 'culture', created_at: 8.days.ago)
expect(Proposal.for_summary.values.flatten).to_not include(proposal) expect(Proposal.for_summary.values.flatten).to_not include(proposal)
end end
it "should order proposals by votes" do 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, 2)
create(:proposal, tag_list: 'culture').update_column(:confidence_score, 10) create(:proposal, tag_list: 'culture').update_column(:confidence_score, 10)
create(:proposal, tag_list: 'culture').update_column(:confidence_score, 5) create(:proposal, tag_list: 'culture').update_column(:confidence_score, 5)
@@ -760,9 +760,9 @@ describe Proposal do
end end
it "should order groups alphabetically" do it "should order groups alphabetically" do
create(:tag, kind: 'category', name: 'health') create(:tag, :category, name: 'health')
create(:tag, kind: 'category', name: 'culture') create(:tag, :category, name: 'culture')
create(:tag, kind: 'category', name: 'social services') create(:tag, :category, name: 'social services')
health_proposal = create(:proposal, tag_list: 'health') health_proposal = create(:proposal, tag_list: 'health')
culture_proposal = create(:proposal, tag_list: 'culture') culture_proposal = create(:proposal, tag_list: 'culture')
@@ -776,8 +776,8 @@ describe Proposal do
end end
it "should return proposals grouped by tag" do it "should return proposals grouped by tag" do
create(:tag, kind: 'category', name: 'culture') create(:tag, :category, name: 'culture')
create(:tag, kind: 'category', name: 'health') create(:tag, :category, name: 'health')
proposal1 = create(:proposal, tag_list: 'culture') proposal1 = create(:proposal, tag_list: 'culture')
proposal2 = create(:proposal, tag_list: 'culture') proposal2 = create(:proposal, tag_list: 'culture')

View File

@@ -41,8 +41,8 @@ describe TagCloud do
end end
it "does not return category tags" do it "does not return category tags" do
create(:tag, kind: 'category', name: 'Education') create(:tag, :category, name: 'Education')
create(:tag, kind: 'category', name: 'Participation') create(:tag, :category, name: 'Participation')
create(:proposal, tag_list: 'education, parks') create(:proposal, tag_list: 'education, parks')
create(:proposal, tag_list: 'participation, water') create(:proposal, tag_list: 'participation, water')
@@ -65,8 +65,8 @@ describe TagCloud do
end end
it "returns tags scoped by category" do it "returns tags scoped by category" do
create(:tag, kind: 'category', name: 'Education') create(:tag, :category, name: 'Education')
create(:tag, kind: 'category', name: 'Participation') create(:tag, :category, name: 'Participation')
create(:proposal, tag_list: 'education, parks') create(:proposal, tag_list: 'education, parks')
create(:proposal, tag_list: 'participation, water') create(:proposal, tag_list: 'participation, water')