spec/server/workflow_spec.rb in cellect-server-0.0.7 vs spec/server/workflow_spec.rb in cellect-server-0.0.8
- old
+ new
@@ -8,54 +8,54 @@
let(:workflow){ Workflow[workflow_type] }
let(:user){ workflow.user 123 }
before(:each){ pass_until workflow, is: :ready }
it 'should provide unseen for users' do
- workflow.subjects.should_receive(:subtract).with user.seen, 3
+ expect(workflow.subjects).to receive(:subtract).with user.seen, 3
workflow.unseen_for 123, limit: 3
end
it 'should sample subjects without a user' do
- workflow.subjects.should_receive(:sample).with 3
+ expect(workflow.subjects).to receive(:sample).with 3
workflow.sample limit: 3
end
it 'should sample subjects with a user' do
- workflow.subjects.should_receive(:subtract).with user.seen, 3
+ expect(workflow.subjects).to receive(:subtract).with user.seen, 3
workflow.sample user_id: 123, limit: 3
end
it 'should add subjects' do
if workflow.prioritized?
- workflow.subjects.should_receive(:add).with 123, 456
+ expect(workflow.subjects).to receive(:add).with 123, 456
workflow.add subject_id: 123, priority: 456
else
- workflow.subjects.should_receive(:add).with 123
+ expect(workflow.subjects).to receive(:add).with 123
workflow.add subject_id: 123
end
end
it 'should remove subjects' do
- workflow.subjects.should_receive(:add).with 123
+ expect(workflow.subjects).to receive(:add).with 123
workflow.add subject_id: 123
end
it 'should be notified of a user ttl expiry' do
async_workflow = double
- workflow.should_receive(:async).and_return async_workflow
- async_workflow.should_receive(:remove_user).with user.id
+ expect(workflow).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
id = user.id
workflow.remove_user id
- workflow.users.should_not have_key id
+ expect(workflow.users).to_not have_key id
expect{ user.id }.to raise_error
end
it 'should not be grouped' do
- workflow.should_not be_grouped
+ expect(workflow).to_not be_grouped
end
end
end
end
end