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
curation_concerns-1.7.1 spec/conversions/power_converters/sipity_action_name_spec.rb
curation_concerns-1.7.0 spec/conversions/power_converters/sipity_action_name_spec.rb
curation_concerns-1.7.0.beta1 spec/conversions/power_converters/sipity_action_name_spec.rb