Commit 403967db
Changed files (5)
app
controllers
helpers
config
spec
controllers
factories
config/routes.rb
@@ -26,9 +26,10 @@ Cake::Application.routes.draw do
get 'categories/:slug/page/:page' => "categories#show"
# /tags
- resources :tags, :only => [:show] do
+ resources :tags, :only => [:index, :show], :path => :t do
get 'page/:page', :action => :show
end
+ get 'tags/:id' => 'tags#show'
# /search
get "search/index"
spec/controllers/tag_controller_spec.rb
@@ -1,6 +1,20 @@
require "spec_helper"
describe TagsController do
+ describe :index do
+ let(:cake) { FactoryGirl.create(:creation) }
+ let(:user) { FactoryGirl.create(:user) }
+
+ before :each do
+ user.tag(cake, :with => "cake", :on => :tags)
+ get :index
+ end
+
+ it "should load all the tags" do
+ assigns(:tags).count.should == 1
+ assigns(:tags).first.name.should == "cake"
+ end
+ end
describe :show do
let(:tag) { "cake" }
let(:tagged_tutorial) { FactoryGirl.create(:tutorial) }
spec/factories/tag.rb
@@ -0,0 +1,5 @@
+FactoryGirl.define do
+ factory :tag, :class => "ActsAsTaggableOn::Tag" do
+ name "cake"
+ end
+end