Sha256: f78c359f5f38fb1ae26a2027851ad13cdadf65836b4f97ef1d2f085ab95f88d6

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 Bytes

Contents

require 'pathname'
require 'yaml'
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'

describe DataMapper::Serialize, '#to_yaml' do
  #
  # ==== yummy YAML
  #

  before(:all) do
    @harness = Class.new(SerializerTestHarness) do
      def method_name
        :to_yaml
      end

      protected

      def deserialize(result)
        stringify_keys = lambda {|hash| hash.inject({}) {|a, (key, value)| a.update(key.to_s => value) }}
        result = YAML.load(result)
        if result.is_a?(Array)
          result.collect(&stringify_keys)
        else
          stringify_keys[result]
        end
      end
    end.new
  end

  it_should_behave_like "A serialization method"

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dm-serializer-0.9.8 spec/public/to_yaml_spec.rb