Sha256: 111c3ed729f7f124a769ce161367d1be9c710da8fb54b423db29feb70890e706

Contents?: true

Size: 1.07 KB

Versions: 23

Compression:

Stored size: 1.07 KB

Contents

require "spec_helper"

RSpec.describe 'PowerConverter', :no_clean do
  context '#convert_to_sipity_action_name' do
    [
      [:show, 'show'],
      [:show?, 'show'],
      [:new?, 'new'],
      [:new, 'new'],
      [:edit?, 'edit'],
      [:edit, 'edit'],
      [:submit, 'submit'],
      [:submit?, 'submit'],
      [:attach, 'attach'],
      [Sipity::WorkflowAction.new(name: 'hello'), 'hello']
    ].each_with_index do |(original, expected), index|
      it "will convert #{original.inspect} to #{expected.inspect} (scenario ##{index})" do
        expect(PowerConverter.convert_to_sipity_action_name(original)).to eq(expected)
      end
    end

    it 'will raise an exception if it is not processible' do
      object = double('Bad Wolf')
      expect { PowerConverter.convert_to_sipity_action_name(object) }.to raise_error(PowerConverter::ConversionError)
    end

    it 'will leverage a short-circuit #to_processing_action_name' do
      object = double(to_sipity_action_name: 'bob')
      expect(PowerConverter.convert_to_sipity_action_name(object)).to eq('bob')
    end
  end
end

Version data entries

23 entries across 23 versions & 3 rubygems

Version Path
hyrax-1.1.1 spec/conversions/power_converters/sipity_action_name_spec.rb
hyrax-1.1.0 spec/conversions/power_converters/sipity_action_name_spec.rb
hyrax-1.0.5 spec/conversions/power_converters/sipity_action_name_spec.rb
curation_concerns-1.7.8 spec/conversions/power_converters/sipity_action_name_spec.rb
hyrax-1.0.4 spec/conversions/power_converters/sipity_action_name_spec.rb
hyrax-1.0.3 spec/conversions/power_converters/sipity_action_name_spec.rb
hyrax-1.0.2 spec/conversions/power_converters/sipity_action_name_spec.rb
hyrax-1.0.1 spec/conversions/power_converters/sipity_action_name_spec.rb
hyrax-1.0.0.rc2 spec/conversions/power_converters/sipity_action_name_spec.rb
curation_concerns-1.7.7 spec/conversions/power_converters/sipity_action_name_spec.rb
curation_concerns-2.0.0 spec/conversions/power_converters/sipity_action_name_spec.rb
curation_concerns-2.0.0.rc2 spec/conversions/power_converters/sipity_action_name_spec.rb
hyrax-1.0.0.rc1 spec/conversions/power_converters/sipity_action_name_spec.rb
curation_concerns-1.7.6 spec/conversions/power_converters/sipity_action_name_spec.rb
curation_concerns-1.7.5 spec/conversions/power_converters/sipity_action_name_spec.rb
test_hyrax-0.0.1.alpha spec/conversions/power_converters/sipity_action_name_spec.rb
curation_concerns-1.7.4 spec/conversions/power_converters/sipity_action_name_spec.rb
curation_concerns-1.7.3 spec/conversions/power_converters/sipity_action_name_spec.rb
curation_concerns-1.7.2 spec/conversions/power_converters/sipity_action_name_spec.rb
curation_concerns-2.0.0.rc1 spec/conversions/power_converters/sipity_action_name_spec.rb