Sha256: 226e1d99799123a8ba2fb1241bb5ffeeee0d3726ebded1eac397e9a0a6f8f6ff

Contents?: true

Size: 949 Bytes

Versions: 16

Compression:

Stored size: 949 Bytes

Contents

require './spec/spec_helper'

describe RestPack::Serializer::Factory do
  let(:factory) { RestPack::Serializer::Factory }

  it "creates by string" do
    factory.create("Song").should be_an_instance_of(SongSerializer)
  end
  it "creates by lowercase string" do
    factory.create("song").should be_an_instance_of(SongSerializer)
  end
  it "creates by lowercase plural string" do
    factory.create("songs").should be_an_instance_of(SongSerializer)
  end
  it "creates by symbol" do
    factory.create(:song).should be_an_instance_of(SongSerializer)
  end
  it "creates by class" do
    factory.create(Song).should be_an_instance_of(SongSerializer)
  end

  it "creates multiple with Array" do
    serializers = factory.create("Song", "artists", :album)
    serializers[0].should be_an_instance_of(SongSerializer)
    serializers[1].should be_an_instance_of(ArtistSerializer)
    serializers[2].should be_an_instance_of(AlbumSerializer)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
restpack_serializer-0.4.2 spec/factory/factory_spec.rb
restpack_serializer-0.4.1 spec/factory/factory_spec.rb
restpack_serializer-0.2.16 spec/factory/factory_spec.rb
restpack_serializer-0.2.15 spec/factory/factory_spec.rb
restpack_serializer-0.2.14 spec/factory/factory_spec.rb
restpack_serializer-0.2.13 spec/factory/factory_spec.rb
restpack_serializer-0.2.12 spec/factory/factory_spec.rb
restpack_serializer-0.2.11 spec/factory/factory_spec.rb
restpack_serializer-0.2.10 spec/factory/factory_spec.rb
restpack_serializer-0.2.9 spec/factory/factory_spec.rb
restpack_serializer-0.2.8 spec/factory/factory_spec.rb
restpack_serializer-0.2.7 spec/factory/factory_spec.rb
restpack_serializer-0.2.6 spec/factory/factory_spec.rb
restpack_serializer-0.2.5 spec/factory/factory_spec.rb
restpack_serializer-0.2.4 spec/factory/factory_spec.rb
restpack_serializer-0.2.3 spec/factory/factory_spec.rb