mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
add top page
This commit is contained in:
@@ -13,14 +13,14 @@ describe ListController do
|
||||
|
||||
describe 'indexes' do
|
||||
|
||||
[:latest, :hot].each do |filter|
|
||||
Discourse.anonymous_filters.each do |filter|
|
||||
context "#{filter}" do
|
||||
before { xhr :get, filter }
|
||||
it { should respond_with(:success) }
|
||||
end
|
||||
end
|
||||
|
||||
[:favorited, :read, :posted, :unread, :new].each do |filter|
|
||||
Discourse.logged_in_filters.each do |filter|
|
||||
context "#{filter}" do
|
||||
it { expect { xhr :get, filter }.to raise_error(Discourse::NotLoggedIn) }
|
||||
end
|
||||
@@ -39,7 +39,7 @@ describe ListController do
|
||||
|
||||
describe 'RSS feeds' do
|
||||
|
||||
[:latest, :hot].each do |filter|
|
||||
Discourse.anonymous_filters.each do |filter|
|
||||
|
||||
it 'renders RSS' do
|
||||
get "#{filter}_feed", format: :rss
|
||||
@@ -175,14 +175,6 @@ describe ListController do
|
||||
end
|
||||
end
|
||||
|
||||
context 'hot' do
|
||||
before do
|
||||
xhr :get, :hot
|
||||
end
|
||||
|
||||
it { should respond_with(:success) }
|
||||
end
|
||||
|
||||
context 'favorited' do
|
||||
it 'raises an error when not logged in' do
|
||||
lambda { xhr :get, :favorited }.should raise_error(Discourse::NotLoggedIn)
|
||||
|
||||
30
spec/models/top_topic_spec.rb
Normal file
30
spec/models/top_topic_spec.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe TopTopic do
|
||||
|
||||
it { should belong_to :topic }
|
||||
|
||||
context "refresh!" do
|
||||
|
||||
let!(:t1) { Fabricate(:topic) }
|
||||
let!(:t2) { Fabricate(:topic) }
|
||||
|
||||
it "begins blank" do
|
||||
TopTopic.all.should be_blank
|
||||
end
|
||||
|
||||
context "after calculating" do
|
||||
|
||||
before do
|
||||
TopTopic.refresh!
|
||||
end
|
||||
|
||||
it "should have top topics" do
|
||||
TopTopic.pluck(:topic_id).should =~ [t1.id, t2.id]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user