Sha256: e382de9dc8260e4b6fae329a2dc0a67f575f082cb25ac289eb323e1ed0358f73

Contents?: true

Size: 1005 Bytes

Versions: 20

Compression:

Stored size: 1005 Bytes

Contents

require '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(MyApp::SongSerializer)
  end
  it "creates by lowercase string" do
    factory.create("song").should be_an_instance_of(MyApp::SongSerializer)
  end
  it "creates by lowercase plural string" do
    factory.create("songs").should be_an_instance_of(MyApp::SongSerializer)
  end
  it "creates by symbol" do
    factory.create(:song).should be_an_instance_of(MyApp::SongSerializer)
  end
  it "creates by class" do
    factory.create(MyApp::Song).should be_an_instance_of(MyApp::SongSerializer)
  end

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
restpack_serializer-0.4.26 spec/factory/factory_spec.rb
restpack_serializer-0.4.25 spec/factory/factory_spec.rb
restpack_serializer-0.4.24 spec/factory/factory_spec.rb
restpack_serializer-0.4.23 spec/factory/factory_spec.rb
restpack_serializer-0.4.21 spec/factory/factory_spec.rb
restpack_serializer-0.4.20 spec/factory/factory_spec.rb
restpack_serializer-0.4.19 spec/factory/factory_spec.rb
restpack_serializer-0.4.18 spec/factory/factory_spec.rb
restpack_serializer-0.4.17 spec/factory/factory_spec.rb
restpack_serializer-0.4.16 spec/factory/factory_spec.rb
restpack_serializer-0.4.15 spec/factory/factory_spec.rb
restpack_serializer-0.4.14 spec/factory/factory_spec.rb
restpack_serializer-0.4.13 spec/factory/factory_spec.rb
restpack_serializer-0.4.12 spec/factory/factory_spec.rb
restpack_serializer-0.4.11 spec/factory/factory_spec.rb
restpack_serializer-0.4.10 spec/factory/factory_spec.rb
restpack_serializer-0.4.9 spec/factory/factory_spec.rb
restpack_serializer-0.4.8 spec/factory/factory_spec.rb
restpack_serializer-0.4.7 spec/factory/factory_spec.rb
restpack_serializer-0.4.6 spec/factory/factory_spec.rb