Sha256: 90904e057939879f5c4f16edd170f284dba1ccce75208643959be95e5e6c7498
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
require 'spec_helper' module Cellect::Server describe API do include_context 'API' { 'Ungrouped' => nil, 'Grouped' => 'grouped' }.each_pair do |grouping_type, grouping| SET_TYPES.shuffle.each do |set_type| context "#{ grouping_type } #{ set_type }" do let(:workflow_type){ [grouping, set_type].compact.join '_' } let(:workflow){ Workflow[workflow_type] } let(:user){ workflow.user 123 } before(:each){ pass_until_state_of workflow, is: :ready } let(:opts) do { subject_id: 123 }.tap do |h| h[:priority] = 456.0 if workflow.prioritized? h[:group_id] = 1 if workflow.grouped? end end it 'should add subjects' do if workflow.grouped? && workflow.prioritized? expect(workflow).to receive(:add).with subject_id: 123, group_id: 1, priority: 456.0 elsif workflow.grouped? expect(workflow).to receive(:add).with subject_id: 123, group_id: 1, priority: nil elsif workflow.prioritized? expect(workflow).to receive(:add).with subject_id: 123, group_id: nil, priority: 456.0 else expect(workflow).to receive(:add).with subject_id: 123, group_id: nil, priority: nil end put "/workflows/#{ workflow_type }/add", opts expect(last_response.status).to eq 200 end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cellect-server-1.3.1 | spec/server/api/add_spec.rb |
cellect-server-1.3.0 | spec/server/api/add_spec.rb |