mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
Merge pull request #290 from alxndr/category-rss
RSS for topics in a category
This commit is contained in:
commit
d410f043a9
11 changed files with 85 additions and 12 deletions
|
@ -51,6 +51,12 @@ describe TopicQuery do
|
|||
it "returns nothing when filtering by another category" do
|
||||
topic_query.list_category(Fabricate(:category, name: 'new cat')).topics.should be_blank
|
||||
end
|
||||
|
||||
describe '#list_new_in_category' do
|
||||
it 'returns only the categorized topic' do
|
||||
topic_query.list_new_in_category(category).topics.should == [topic_in_cat]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'unread / read topics' do
|
||||
|
|
|
@ -43,6 +43,14 @@ describe ListController do
|
|||
it { should respond_with(:success) }
|
||||
end
|
||||
|
||||
describe 'feed' do
|
||||
it 'renders RSS' do
|
||||
get :category_feed, category: category.slug, format: :rss
|
||||
response.should be_success
|
||||
response.content_type.should == 'application/rss+xml'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'uncategorized' do
|
||||
|
@ -59,8 +67,6 @@ describe ListController do
|
|||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
context 'favorited' do
|
||||
|
|
|
@ -1033,4 +1033,17 @@ describe Topic do
|
|||
|
||||
end
|
||||
|
||||
describe 'scopes' do
|
||||
describe '#by_most_recently_created' do
|
||||
it 'returns topics ordered by created_at desc, id desc' do
|
||||
now = Time.now
|
||||
a = Fabricate(:topic, created_at: now - 2.minutes)
|
||||
b = Fabricate(:topic, created_at: now)
|
||||
c = Fabricate(:topic, created_at: now)
|
||||
d = Fabricate(:topic, created_at: now - 2.minutes)
|
||||
Topic.by_newest.should == [c,b,d,a]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue