wrote a failing test for what I think the lack of aspect notifier is; the cache is returning strings and not integers

This commit is contained in:
Maxwell Salzberg 2011-10-23 20:15:09 -07:00
parent b92cb921c1
commit 7307960d82
2 changed files with 10 additions and 1 deletions

View file

@ -49,7 +49,7 @@ class Stream::Multi < Stream::Base
# @return [Symbol]
def is_in?(sym, post)
if self.send("#{sym.to_s}_post_ids").find{|x| x == post.id}
if self.send("#{sym.to_s}_post_ids").find{|x| x.to_s == post.id.to_s}
"#{sym.to_s}_stream".to_sym
end
end

View file

@ -6,7 +6,16 @@ describe Stream::Multi do
@stream = Stream::Multi.new(Factory(:user), :max_time => Time.now, :order => 'updated_at')
end
describe 'shared behaviors' do
it_should_behave_like 'it is a stream'
end
describe '#is_in?' do
it 'handles when the cache returns strings' do
p = Factory(:status_message)
@stream.should_receive(:aspects_post_ids).and_return([p.id.to_s])
@stream.send(:is_in?, :aspects, p).should be_true
end
end
end