Sha256: 194e388689107d0fc41352a1e091d33a88562ea56ab2c9f09d5b7bdd38b550ff
Contents?: true
Size: 1.92 KB
Versions: 2
Compression:
Stored size: 1.92 KB
Contents
require 'spec_helper' describe 'ActivityFeed::Item' do it 'should allow you to create a new Item' do item = Fabricate.build(ActivityFeed.persistence) item.save.should be_true end it 'should allow for a large amount of text' do item = Fabricate.build(ActivityFeed.persistence, :text => '*' * 8192) item.text.should eql('*' * 8192) end it 'should add the feed item ID to redis' do item = Fabricate.build(ActivityFeed.persistence) ActivityFeed.redis.zcard(ActivityFeed.feed_key(item.user_id)).should be(0) item.save ActivityFeed.redis.zcard(ActivityFeed.feed_key(item.user_id)).should be(1) ActivityFeed.aggregate_item(item) ActivityFeed.redis.zcard(ActivityFeed.feed_key(item.user_id, true)).should be(1) end it 'should have default attributes for .title .url .icon and .sticky' do item = Fabricate.build(ActivityFeed.persistence) item.title.should eql('item title') item.url.should eql('http://url') item.icon.should eql('http://icon') item.sticky.should be_false end it 'should not create a new item in Redis after saving, only on create' do item = Fabricate.build(ActivityFeed::Memory::Item) ActivityFeed.redis.zcard(ActivityFeed.feed_key(item.user_id)).should be(0) item.save ActivityFeed.redis.zcard(ActivityFeed.feed_key(item.user_id)).should be(1) ActivityFeed.aggregate_item(item) ActivityFeed.redis.zcard(ActivityFeed.feed_key(item.user_id, true)).should be(1) item.text = 'updated text' item.save ActivityFeed.redis.zcard(ActivityFeed.feed_key(item.user_id)).should be(1) ActivityFeed.aggregate_item(item) ActivityFeed.redis.zcard(ActivityFeed.feed_key(item.user_id, true)).should be(1) end it 'should output all the attributes for an item for Ohm' do item = Fabricate.build(ActivityFeed::Ohm::Item) hash = JSON.parse(item.to_json) hash.keys.size.should be(8) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activity_feed-1.4.0 | spec/item_spec.rb |
activity_feed-1.3.0 | spec/item_spec.rb |