Commit 1f011644
Changed files (2)
spec
controllers
factories
spec/controllers/categories_controller_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe CategoriesController do
- let(:creation) { FactoryGirl.create(:creation) }
- let(:category) { FactoryGirl.create(:category, :creations => [creation]) }
+ let(:creation) { create(:creation) }
+ let(:category) { create(:category, :creations => [creation]) }
describe "GET show" do
context "when there is a category that matches the slug" do
@@ -10,15 +10,16 @@ describe CategoriesController do
before { get :show, :slug => category.slug }
it "should return the creations in the category" do
- assigns(:creations).should == [creation]
+ assigns(:creations).should include(creation)
end
+
it "should return the category" 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') }
+ let(:other_category) { create(:category, :slug => 'booooo') }
before { get :show, :slug => other_category.to_param }
spec/factories/category.rb
@@ -1,6 +1,6 @@
FactoryGirl.define do
factory :category, class: Category do
name { Faker::Name.name }
- slug { Faker::Name.name }
+ slug { Faker::Name.name.gsub(/ /, "-").downcase }
end
end