Sha256: 11a175029595d3632efbec5c3d57b1294097bb368ff7d41b6f34e55fa2e2549e

Contents?: true

Size: 966 Bytes

Versions: 2

Compression:

Stored size: 966 Bytes

Contents

require 'spec_helper'

module Id::Field
  describe Summary do
    it 'constructs a summary of the definition' do
      definition = Id::Field::Definition.new(:cats,
                                             optional: true,
                                             key: 'kittens',
                                             type: String,
                                             default: -> { "KITTEH!"})
      summary = definition.to_s
      expect(summary).to eq "Name: cats\n"   +
                            "Type: String\n" +
                            "Key in hash: kittens\n" +
                            "Optional: true\n" +
                            "Default: Lambda"
    end

    it 'omits info for options that are not specified' do
      definition = Id::Field::Definition.new(:cats, type: String)
      summary = definition.to_s
      expect(summary).to eq "Name: cats\n"   +
                            "Type: String"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
id-0.1.1 spec/lib/id/field/summary_spec.rb
id-0.1 spec/lib/id/field/summary_spec.rb