 {EventEmitter} = require 'events'
 #{Server, Db, ObjectID} = require 'mongodb'
 
+limit = require './helpers/limit'
 {Stream} = require '../'
 samplePolicy = require '../sample/data/samplePolicy'
-
-limit = (policy, sources) ->
-  newPolicy = _.clone policy
-  newPolicy.dataSources = _.pick newPolicy.dataSources, sources
-  newPolicy
 
 describe 'Stream', ->
   beforeEach ->

        _id: 2
        operation: 'set'
        path: '.'
        data: { _id: 2, accountId: 1, name: 'Jane' }
      }
      done()


        _id: 1
        operation: 'set'
        path: '.'
        data: { _id: 1, accountId: 1, name: 'Bob', email: 'bob@foo.com' }
      }
      jane.should.include {
        origin: 'end payload'
