moar tests
This commit is contained in:
parent
a3eeb9f3c1
commit
772d0241d9
2 changed files with 26 additions and 0 deletions
|
|
@ -10,4 +10,26 @@ describe TagStream do
|
||||||
describe 'shared behaviors' do
|
describe 'shared behaviors' do
|
||||||
it_should_behave_like 'it is a stream'
|
it_should_behave_like 'it is a stream'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '.can_comment?' do
|
||||||
|
before do
|
||||||
|
@stream = TagStream.new(alice)
|
||||||
|
@stream.stub(:people).and_return([bob.person])
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns true if user is a contact of the post author' do
|
||||||
|
post = Factory(:status_message, :author => bob.person)
|
||||||
|
@stream.can_comment?(post).should be_true
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns true if a user is the author of the post' do
|
||||||
|
post = Factory(:status_message, :author => alice.person)
|
||||||
|
@stream.can_comment?(post).should be_true
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns false otherwise' do
|
||||||
|
post = Factory(:status_message, :author => eve.person)
|
||||||
|
@stream.can_comment?(post).should be_false
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,10 @@ describe 'Streams' do
|
||||||
@stream.order=nil
|
@stream.order=nil
|
||||||
@stream.order.should == 'created_at'
|
@stream.order.should == 'created_at'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should have can_comment?(post)' do
|
||||||
|
@stream.can_comment?(Factory(:status_message)).should_not be_nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue