Sha256: 8b493de40af34894911dd57e74e368cb7ffc9c23b7db4245019c5ed6f1858406
Contents?: true
Size: 837 Bytes
Versions: 16
Compression:
Stored size: 837 Bytes
Contents
require "spec_helper" require "lutaml/model/yaml_adapter" require_relative "../../fixtures/sample_model" RSpec.shared_examples "a YAML adapter" do |adapter_class| let(:attributes) { { "name" => "John Doe", "age" => 30 } } let(:model) { SampleModel.new(attributes) } let(:expected_yaml) do if adapter_class == Lutaml::Model::YamlAdapter::StandardYamlAdapter attributes.to_yaml end end it "serializes to YAML" do yaml = adapter_class.new(attributes).to_yaml expect(yaml).to eq(expected_yaml) end it "deserializes from YAML" do new_model = adapter_class.parse(expected_yaml) expect(new_model["name"]).to eq("John Doe") expect(new_model["age"]).to eq(30) end end RSpec.describe Lutaml::Model::YamlAdapter::StandardYamlAdapter do it_behaves_like "a YAML adapter", described_class end
Version data entries
16 entries across 16 versions & 1 rubygems