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
|
category_list.categories.should be_blank
|
||||||
end
|
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)
|
Guardian.any_instance.expects(:can_create?).with(Category).returns(true)
|
||||||
category_list.categories.should_not be_blank
|
category_list.categories.should_not be_blank
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,8 +82,6 @@ describe CategoryList do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Fabricator(:category) do
|
Fabricator(:category) do
|
||||||
name 'Amazing Category'
|
name { sequence(:name) { |n| "Amazing Category #{n}" } }
|
||||||
user
|
user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ describe Category do
|
||||||
|
|
||||||
describe 'after create' do
|
describe 'after create' do
|
||||||
before do
|
before do
|
||||||
@category = Fabricate(:category)
|
@category = Fabricate(:category, name: 'Amazing Category')
|
||||||
@topic = @category.topic
|
@topic = @category.topic
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue