spec/cellect/server/workflow_spec.rb in cellect-server-2.1.1 vs spec/cellect/server/workflow_spec.rb in cellect-server-3.0.0
- old
+ new
@@ -7,15 +7,17 @@
Workflow['random']
end
SET_TYPES.each do |workflow_type|
context workflow_type do
- it_behaves_like 'workflow', :workflow
- let(:workflow){ Workflow[workflow_type] }
- let(:user){ workflow.user 123 }
- before(:each){ pass_until_state_of workflow, is: :ready }
+ let(:workflow) { Workflow.new(workflow_type) }
+ let(:user) { workflow.user 123 }
+ it_behaves_like 'workflow', :workflow do
+ let(:obj) { workflow }
+ end
+
it 'should provide unseen for users' do
expect(workflow.subjects).to receive(:subtract).with user.seen, 3
workflow.unseen_for 123, limit: 3
end
@@ -44,10 +46,10 @@
workflow.remove subject_id: 123
end
it 'should be notified of a user ttl expiry' do
async_workflow = double
- expect(workflow).to receive(:async).and_return async_workflow
+ expect(Workflow[workflow.name]).to receive(:async).and_return async_workflow
expect(async_workflow).to receive(:remove_user).with user.id
user.ttl_expired!
end
it 'should remove users when their ttl expires' do