Add a spec for category list with empty category

This commit is contained in:
Neil Lalonde 2013-05-07 15:52:45 -04:00
parent 52ee1928cc
commit f9a82f3aa0
3 changed files with 10 additions and 5 deletions

View File

@ -50,11 +50,18 @@ describe CategoryList do
category_list.categories.should be_blank
end
it "returns empty categories for those who can create them" do
it "returns empty the empty for those who can create them" do
Guardian.any_instance.expects(:can_create?).with(Category).returns(true)
category_list.categories.should_not be_blank
end
it 'returns the empty category and a non-empty category for those who can create them' do
category_with_topics = Fabricate(:topic, category: Fabricate(:category))
Guardian.any_instance.expects(:can_create?).with(Category).returns(true)
category_list.categories.should have(2).categories
category_list.categories.should include(topic_category)
end
end
@ -75,8 +82,6 @@ describe CategoryList do
end
end
end
end

View File

@ -1,5 +1,5 @@
Fabricator(:category) do
name 'Amazing Category'
name { sequence(:name) { |n| "Amazing Category #{n}" } }
user
end

View File

@ -95,7 +95,7 @@ describe Category do
describe 'after create' do
before do
@category = Fabricate(:category)
@category = Fabricate(:category, name: 'Amazing Category')
@topic = @category.topic
end