Fix more specs. Added an explicit spec for all_comments .

This commit is contained in:
Pistos 2011-10-15 16:21:26 -04:00
parent 511d51318d
commit 153615e651
3 changed files with 27 additions and 1 deletions

View file

@ -8,6 +8,7 @@ class SocketsController < ApplicationController
include Rails.application.routes.url_helpers
helper_method :all_aspects
helper_method :current_user
helper_method 'all_comments?'
def incoming(msg)
Rails.logger.info("Socket received connection to: #{msg}")
@ -45,6 +46,11 @@ class SocketsController < ApplicationController
@all_aspects ||= user.aspects
end
# Override of CommentsHelper#all_comments? .
def all_comments?
false
end
class SocketRequest < ActionDispatch::Request
def format
'socket'

View file

@ -44,6 +44,6 @@ module CommentsHelper
end
def all_comments?
defined?(request_parameters) && !! params['all_comments']
!! params['all_comments']
end
end

View file

@ -76,6 +76,26 @@ describe PostsController do
response.body.should == @status.to_diaspora_xml
end
context 'with more than 3 comments' do
before do
(1..5).each do |i|
alice.comment "comment #{i}", :post => @status
end
end
it 'shows all comments of a public post' do
get :show, :id => @status.id
response.body.should =~ /comment 3/
response.body.should_not =~ /comment 2/
get :show, :id => @status.id, 'all_comments' => '1'
response.body.should =~ /comment 3/
response.body.should =~ /comment 2/
end
end
end
it 'shows a public photo' do