Sha256: dbfb5e4bfc7d8e4df4c6d9e4c712c6a8cca30c5249f13a6ad8210dec9f8a2d45

Contents?: true

Size: 900 Bytes

Versions: 16

Compression:

Stored size: 900 Bytes

Contents

require 'spec_helper'

module Cellect::Server
  describe User do
    let(:user){ User.new 1, workflow_name: 'random' }

    it 'should store seen ids' do
      expect(user.seen).to be_a DiffSet::RandomSet
    end

    it 'should have a default ttl of 15 minutes' do
      expect(user.ttl).to eq 900 # seconds
    end

    it 'should allow custom ttl' do
      expect(User.new(2, workflow_name: 'random', ttl: 123).ttl).to eq 123
    end

    it 'should reset the ttl timer on activity' do
      expect(user.bare_object).to receive(:restart_ttl_timer).at_least :once
      user.seen
    end

    it 'should terminate on ttl expiry' do
      async_workflow = double
      expect(Workflow[user.workflow_name]).to receive(:async).and_return async_workflow
      expect(async_workflow).to receive(:remove_user).with user.id
      user.ttl_expired!
      expect(user.ttl_timer).to be_nil
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
cellect-server-2.1.1 spec/cellect/server/user_spec.rb
cellect-server-2.1.0 spec/cellect/server/user_spec.rb
cellect-server-2.0.1 spec/cellect/server/user_spec.rb
cellect-server-2.0.0 spec/cellect/server/user_spec.rb
cellect-server-2.0.0.beta4 spec/cellect/server/user_spec.rb
cellect-server-2.0.0.beta3 spec/cellect/server/user_spec.rb
cellect-server-2.0.0.beta2 spec/cellect/server/user_spec.rb
cellect-server-2.0.0.beta1 spec/cellect/server/user_spec.rb
cellect-server-1.3.3 spec/server/user_spec.rb
cellect-server-1.3.2 spec/server/user_spec.rb
cellect-server-1.3.1 spec/server/user_spec.rb
cellect-server-1.3.0 spec/server/user_spec.rb
cellect-server-1.2.0 spec/server/user_spec.rb
cellect-server-1.1.0 spec/server/user_spec.rb
cellect-server-1.0.1 spec/server/user_spec.rb
cellect-server-1.0.0 spec/server/user_spec.rb