mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 19:53:44 +08:00
b5eff93a9d
start work on user_tracking_state fix can_ban? in guardian expose protected scopes on topic_query we need move guardian spec to use build as opposed to creating topics / posts / users start work on user tracking spec
35 lines
575 B
Ruby
35 lines
575 B
Ruby
require 'spec_helper'
|
|
|
|
describe UserTrackingState do
|
|
|
|
let(:user) do
|
|
Fabricate(:user)
|
|
end
|
|
|
|
let(:post) do
|
|
Fabricate(:post)
|
|
end
|
|
|
|
let(:state) do
|
|
UserTrackingState.new(user)
|
|
end
|
|
|
|
it "correctly gets the list of new topics" do
|
|
state.new_list.should == []
|
|
state.unread_list.should == []
|
|
|
|
new_post = post
|
|
|
|
new_list = state.new_list
|
|
|
|
new_list.length.should == 1
|
|
new_list[0][0].should == post.topic.id
|
|
new_list[0][1].should be_within(1.second).of(post.topic.created_at)
|
|
|
|
state.unread_list.should == []
|
|
|
|
# read it
|
|
|
|
end
|
|
end
|