tests for commentshelper shim
This commit is contained in:
parent
772d0241d9
commit
6252436b34
1 changed files with 36 additions and 15 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe CommentsHelper do
|
describe CommentsHelper do
|
||||||
|
describe '.new_comment_form' do
|
||||||
before do
|
before do
|
||||||
@user = alice
|
@user = alice
|
||||||
@aspect = @user.aspects.first
|
@aspect = @user.aspects.first
|
||||||
|
|
@ -18,4 +19,24 @@ describe CommentsHelper do
|
||||||
}
|
}
|
||||||
(time*1000).should < 1
|
(time*1000).should < 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'commenting_disabled?' do
|
||||||
|
it 'returns true if @commenting_disabled is set' do
|
||||||
|
@commenting_disabled = true
|
||||||
|
commenting_disabled?(stub).should_be true
|
||||||
|
@commenting_disabled = false
|
||||||
|
commenting_disabled?(stub).should_be false
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns @stream.can_comment? if @stream is set' do
|
||||||
|
post = stub
|
||||||
|
@stream = stub
|
||||||
|
@stream.should_receive(:can_comment?).with(post).and_return(true)
|
||||||
|
commenting_disabled?(post).should_be true
|
||||||
|
|
||||||
|
@stream.should_receive(:can_comment?).with(post).and_return(false)
|
||||||
|
commenting_disabled?(post).should_be false
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue