Sha256: 04c5e92a459d85584bb8b14e1073ed6973d99fa45e48e9046b8537dcb0bb4a7f

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

# Copyright:: (c) Autotelik Media Ltd 2015
# Author ::   Tom Statter
# Date ::     Aug 2015
# License::   MIT
#
# Details::   Specs for Mapping aspects
#             Provides automatic mapping between different system's column headings
#
require File.join(File.dirname(__FILE__), '/../spec_helper')

describe 'MapperUtils' do

  it 'should identify the class from a string' do
    # Similar to const_get_from_string except this version
    # returns nil if no such class found
    # Support modules e.g "Spree::Property"
    #
    expect(DataShift::MapperUtils.class_from_string( Project)).to be_a Class
  end

  it 'should identify the class from a string containing modules' do
    # Similar to const_get_from_string except this version
    # returns nil if no such class found
    # Support modules e.g "Spree::Property"
    #
    expect(DataShift::MapperUtils.class_from_string( DataShift::AClassInAModule )).to be_a Class
  end

  it 'should ensure a valid class is returned whether a class or string passed in' do
    expect(DataShift::MapperUtils.ensure_class("Project")).to be_a Class
    expect(DataShift::MapperUtils.ensure_class(Project)).to be_a Class
  end

  it 'should throw when invalid class supplied' do
    expect { DataShift::MapperUtils.ensure_class("Proj") }.to raise_error
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
datashift-0.40.1 spec/datashift/mapper_utils_spec.rb
datashift-0.40.0 spec/datashift/mapper_utils_spec.rb