Sha256: 037748956200185d21a136630f1246147247f04f65206dcd2c809f2d5af33fa8

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'
require 'activity_engine'

describe ActivityEngine do
  class Cat < PersistenceLayer
    def initialize(name)
      super()
      @name = name
    end
    attr_reader :name
    def eat(food); food; end
  end
  Food = Struct.new(:name)

  describe '.register' do
    let(:cat) { Cat.new('Beautiful Steve') }
    let(:food) { Food.new('catsup') }
    let(:receiver) { ActivityEngine::Activity }

    it 'reports when the method is called' do
      ActivityEngine.register(Cat, :eat, receiver) do |config, context|
        config.subject = context
        config.activity_type = 'Cat#eat'
      end
      cat.eat(food)
      expect(receiver.last.subject).to eq(cat)
    end
  end

  describe 'entry creation' do
    it 'creates an entry for a persisted object'
    it 'requires an object to be persisted'
    it 'extracts the requesting user from the context'
    it 'extracts the entry type from the context'
  end

  describe 'entry finder scopes' do
    it 'has a scope for finding based on the persisted object'
    it 'has a scope for finding based on a user'
    it 'has a scope for finding based on an entry type'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activity_engine-0.0.3 spec/lib/activity_engine_spec.rb
activity_engine-0.0.2 spec/lib/activity_engine_spec.rb