Commit 39fd9acf
Changed files (1)
spec
controllers
spec/controllers/categories_controller_spec.rb
@@ -7,17 +7,9 @@ describe CategoriesController do
end
describe "GET show" do
- context "when there is NO category that matches the slug" do
- before(:each) do
- get :show, :id => "!#{@category.slug}"
- end
- it "should redirect to tags" do
- response.should redirect_to("/tags/!#{@category.slug}")
- end
- end
context "when there is a category that matches the slug" do
context "when there are creations in the category" do
- before { get :show, :id => @category.slug }
+ before { get :show, :slug => @category.slug }
it "should return the creations in the category" do
assigns(:creations).should == [@creation]
@@ -26,13 +18,15 @@ describe CategoriesController do
assigns(:category).should == @category
end
end
+
context "when there are no creations in the category" do
let(:other_category) { FactoryGirl.create(:category, :slug => 'booooo') }
- before { get :show, :id => other_category.slug }
+ before { get :show, :slug => other_category.to_param }
it "should return zero creations" do
assigns(:creations).should be_empty
end
+
it "should return the category" do
assigns(:category).should eq(other_category)
end