diff --git a/spec/components/category_list_spec.rb b/spec/components/category_list_spec.rb index 4b224254c..470033def 100644 --- a/spec/components/category_list_spec.rb +++ b/spec/components/category_list_spec.rb @@ -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 diff --git a/spec/fabricators/category_fabricator.rb b/spec/fabricators/category_fabricator.rb index fb2fff552..7ab4c4b75 100644 --- a/spec/fabricators/category_fabricator.rb +++ b/spec/fabricators/category_fabricator.rb @@ -1,5 +1,5 @@ Fabricator(:category) do - name 'Amazing Category' + name { sequence(:name) { |n| "Amazing Category #{n}" } } user end diff --git a/spec/models/category_spec.rb b/spec/models/category_spec.rb index c68981a31..d52e520b5 100644 --- a/spec/models/category_spec.rb +++ b/spec/models/category_spec.rb @@ -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