moar tests

This commit is contained in:
Maxwell Salzberg 2011-10-04 18:10:25 -07:00
parent a3eeb9f3c1
commit 772d0241d9
2 changed files with 26 additions and 0 deletions

View file

@ -10,4 +10,26 @@ describe TagStream do
describe 'shared behaviors' do
it_should_behave_like 'it is a stream'
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

View file

@ -40,6 +40,10 @@ describe 'Streams' do
@stream.order=nil
@stream.order.should == 'created_at'
end
it 'should have can_comment?(post)' do
@stream.can_comment?(Factory(:status_message)).should_not be_nil
end
end
end
end