Sha256: c046460a28ca1c3c631b193789a939764e6c10ca0bb99a7e71768e79d8a19f71

Contents?: true

Size: 691 Bytes

Versions: 1

Compression:

Stored size: 691 Bytes

Contents

require 'spec_helper'

describe ActiveModel::CsvrizerFactory do
  let(:post) { Post.new(name: 'a', body: 'b') }

  describe '#new' do
    it 'builds a serializer with type based on singular association' do
      serializer = ActiveModel::CsvrizerFactory.new(post)
      expect(serializer).to be_a(PostCsvrizer)
    end

    it 'builds a serializer with type based on plural association' do
      serializer = ActiveModel::CsvrizerFactory.new(post)
      expect(serializer).to be_a(PostCsvrizer)
    end

    it 'raises name error when expected serializer not found' do
      expect do
        ActiveModel::CsvrizerFactory.new(Photo.new)
      end.to raise_error(NameError)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csverizer-0.0.4 spec/active_model/csverizer_factory_spec.rb