Sha256: bed95282c1efd61de347a6927a0aa43ba407189a54ace7321bc81f16c7d478d5

Contents?: true

Size: 830 Bytes

Versions: 6

Compression:

Stored size: 830 Bytes

Contents

require 'spec_helper'

RSpec.describe 'PowerConverter', no_clean: true do
  context 'sipity_workflow_state' do
    let(:workflow_state) { Sipity::WorkflowState.new(id: 1, name: 'hello') }
    let(:workflow) { create(:workflow) }
    it 'will convert a Sipity::WorkflowState' do
      expect(PowerConverter.convert(workflow_state, to: :sipity_workflow_state)).to eq(workflow_state)
    end

    it 'will convert a string based on scope' do
      create(:workflow_state, workflow_id: workflow.id, name: 'hello')
      PowerConverter.convert('hello', scope: workflow, to: :sipity_workflow_state)
    end

    it 'will attempt convert a string based on scope' do
      expect { PowerConverter.convert('missing', scope: workflow, to: :sipity_workflow_state) }
        .to raise_error(PowerConverter::ConversionError)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hyrax-1.1.1 spec/conversions/power_converters/sipity_workflow_state_spec.rb
hyrax-1.1.0 spec/conversions/power_converters/sipity_workflow_state_spec.rb
hyrax-1.0.5 spec/conversions/power_converters/sipity_workflow_state_spec.rb
hyrax-1.0.4 spec/conversions/power_converters/sipity_workflow_state_spec.rb
hyrax-1.0.3 spec/conversions/power_converters/sipity_workflow_state_spec.rb
hyrax-1.0.2 spec/conversions/power_converters/sipity_workflow_state_spec.rb