Sha256: 986b05674ad07a9486977909d452dde5f1b52b41e2b05bd4294b0c58cd55aff9

Contents?: true

Size: 1.28 KB

Versions: 13

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe CurationConcerns::Forms::WorkflowResponsibilityForm, :no_clean do
  let(:instance) { described_class.new }

  describe "#initialize" do
    let(:user) { create(:user) }
    let(:instance) { described_class.new(user_id: user.id, workflow_role_id: 7) }
    subject { instance.model_instance }
    it "creates an agent and sets the workflow_role_id" do
      expect(subject.agent).to be_kind_of Sipity::Agent
      expect(subject.workflow_role_id).to eq 7
    end
  end

  describe "#user_options" do
    subject { instance.user_options }
    it { is_expected.to eq User.all }
  end

  describe "#workflow_role_options" do
    let(:workflow) { instance_double(Sipity::Workflow, name: 'generic_work') }
    let(:role1) { instance_double(Sipity::Role, name: 'foo') }
    let(:role2) { instance_double(Sipity::Role, name: 'bar') }
    let(:wf_role1) { instance_double(Sipity::WorkflowRole, workflow: workflow, role: role1, id: 1) }
    let(:wf_role2) { instance_double(Sipity::WorkflowRole, workflow: workflow, role: role2, id: 2) }
    before do
      allow(Sipity::WorkflowRole).to receive(:all).and_return([wf_role1, wf_role2])
    end
    subject { instance.workflow_role_options }
    it { is_expected.to eq [['generic_work - foo', 1], ['generic_work - bar', 2]] }
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb
curation_concerns-1.7.7 spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb
curation_concerns-2.0.0 spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb
curation_concerns-2.0.0.rc2 spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb
curation_concerns-1.7.6 spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb
curation_concerns-1.7.5 spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb
curation_concerns-1.7.4 spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb
curation_concerns-1.7.3 spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb
curation_concerns-1.7.2 spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb
curation_concerns-2.0.0.rc1 spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb
curation_concerns-1.7.1 spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb
curation_concerns-1.7.0 spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb
curation_concerns-1.7.0.beta1 spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb