mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Add a spec for category list with empty category
This commit is contained in:
parent
52ee1928cc
commit
f9a82f3aa0
3 changed files with 10 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Fabricator(:category) do
|
||||
name 'Amazing Category'
|
||||
name { sequence(:name) { |n| "Amazing Category #{n}" } }
|
||||
user
|
||||
end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue