Sha256: 7338e74be000210fb565705c981afb8b33980343d742e94131d668ded20332ec

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'activity_feed'
require 'timecop'
require 'database_cleaner'
require 'support/mongoid'
require 'support/active_record'

RSpec.configure do |config|
  config.mock_with :rspec

  config.before(:all) do
    DatabaseCleaner.strategy = :truncation
    DatabaseCleaner.clean_with(:truncation)
  end

  config.before(:each) do
    DatabaseCleaner.start
    DatabaseCleaner.clean

    ActivityFeed.configure do |configuration|
      configuration.items_loader = nil
      configuration.aggregate = false
      configuration.redis = Redis.new(:db => 15)
    end

    ActivityFeed.redis.flushdb
  end

  config.after(:each) do
    DatabaseCleaner.clean

    ActivityFeed.redis.quit
  end

  # Helper method to add items to a given feed.
  #
  # @param items_to_add [int] Number of items to add to the feed.
  def add_items_to_feed(user_id, items_to_add = 5, aggregate = ActivityFeed.aggregate)
    1.upto(items_to_add) do |index|
      ActivityFeed.update_item(user_id, index, Time.now.to_i, aggregate)
      Timecop.travel(Time.now + 10)
    end

    Timecop.return
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activity_feed-3.1.0 spec/spec_helper.rb
activity_feed-3.0.1 spec/spec_helper.rb
activity_feed-3.0.0 spec/spec_helper.rb