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