fix pending tests

This commit is contained in:
Sam 2013-06-03 17:07:44 +10:00
parent 8b69ee26ff
commit ef976ba891

View File

@ -37,7 +37,7 @@ describe PostCreator do
creator.spam?.should be_false creator.spam?.should be_false
end end
pending 'generates the correct messages for a secure topic' do it 'generates the correct messages for a secure topic' do
admin = Fabricate(:admin) admin = Fabricate(:admin)
@ -57,17 +57,19 @@ describe PostCreator do
topic_id = created_post.topic_id topic_id = created_post.topic_id
messages.map{|m| m.channel}.sort.should == [ "/latest", messages.map{|m| m.channel}.sort.should == [ "/new",
"/users/#{admin.username}", "/users/#{admin.username}",
"/users/#{admin.username}", "/users/#{admin.username}",
"/topic/#{created_post.topic_id}", "/unread/#{admin.id}",
"/category/#{cat.slug}" "/unread/#{admin.id}",
"/topic/#{created_post.topic_id}"
].sort ].sort
admin_ids = [Group[:admins].id] admin_ids = [Group[:admins].id]
messages.any?{|m| m.group_ids != admin_ids}.should be_false
messages.any?{|m| m.group_ids != admin_ids && m.user_ids != [admin.id]}.should be_false
end end
pending 'generates the correct messages for a normal topic' do it 'generates the correct messages for a normal topic' do
p = nil p = nil
messages = MessageBus.track_publish do messages = MessageBus.track_publish do
@ -75,13 +77,16 @@ describe PostCreator do
topic_id = p.topic_id topic_id = p.topic_id
end end
latest = messages.find{|m| m.channel == "/latest"} latest = messages.find{|m| m.channel == "/new"}
latest.should_not be_nil latest.should_not be_nil
read = messages.find{|m| m.channel == "/unread/#{p.user_id}"}
read.should_not be_nil
user_action = messages.find{|m| m.channel == "/users/#{p.user.username}"} user_action = messages.find{|m| m.channel == "/users/#{p.user.username}"}
user_action.should_not be_nil user_action.should_not be_nil
messages.length.should == 2 messages.length.should == 3
end end
it 'extracts links from the post' do it 'extracts links from the post' do