Sha256: 4d1c57855b4bf6744ec69761dcbc544f534d0895dd76eb63059fa62b09de1603

Contents?: true

Size: 885 Bytes

Versions: 27

Compression:

Stored size: 885 Bytes

Contents

require "spec_helper"

RSpec.describe 'PowerConverter', no_clean: true do
  describe '#convert_to_polymorphic_type' do
    it 'will convert an object that responds to #to_polymorphic_type' do
      object = double(to_polymorphic_type: :symbol)
      expect(PowerConverter.convert_to_polymorphic_type(object)).to eq(:symbol)
    end
    it 'will convert an ActiveRecord::Base object' do
      user = FactoryGirl.build(:user)
      expect(PowerConverter.convert_to_polymorphic_type(user)).to eq(user.class)
    end
    it 'will convert an object that responds to #base_class' do
      object = double(base_class: :symbol)
      expect(PowerConverter.convert_to_polymorphic_type(object)).to eq(:symbol)
    end

    it 'will fail to convert strings' do
      expect { PowerConverter.convert_to_polymorphic_type('hello') }.to raise_error(PowerConverter::ConversionError)
    end
  end
end

Version data entries

27 entries across 27 versions & 3 rubygems

Version Path
hyrax-2.0.0.rc1 spec/conversions/power_converters/polymorphic_type_spec.rb
hyrax-1.0.5 spec/conversions/power_converters/polymorphic_type_spec.rb
hyrax-2.0.0.beta5 spec/conversions/power_converters/polymorphic_type_spec.rb
curation_concerns-1.7.8 spec/conversions/power_converters/polymorphic_type_spec.rb
hyrax-2.0.0.beta4 spec/conversions/power_converters/polymorphic_type_spec.rb
hyrax-2.0.0.beta3 spec/conversions/power_converters/polymorphic_type_spec.rb
hyrax-2.0.0.beta2 spec/conversions/power_converters/polymorphic_type_spec.rb
hyrax-2.0.0.beta1 spec/conversions/power_converters/polymorphic_type_spec.rb
hyrax-1.0.4 spec/conversions/power_converters/polymorphic_type_spec.rb
hyrax-1.0.3 spec/conversions/power_converters/polymorphic_type_spec.rb
hyrax-1.0.2 spec/conversions/power_converters/polymorphic_type_spec.rb
hyrax-1.0.1 spec/conversions/power_converters/polymorphic_type_spec.rb
hyrax-1.0.0.rc2 spec/conversions/power_converters/polymorphic_type_spec.rb
curation_concerns-1.7.7 spec/conversions/power_converters/polymorphic_type_spec.rb
curation_concerns-2.0.0 spec/conversions/power_converters/polymorphic_type_spec.rb
curation_concerns-2.0.0.rc2 spec/conversions/power_converters/polymorphic_type_spec.rb
hyrax-1.0.0.rc1 spec/conversions/power_converters/polymorphic_type_spec.rb
curation_concerns-1.7.6 spec/conversions/power_converters/polymorphic_type_spec.rb
curation_concerns-1.7.5 spec/conversions/power_converters/polymorphic_type_spec.rb
test_hyrax-0.0.1.alpha spec/conversions/power_converters/polymorphic_type_spec.rb