Sha256: 991d95182824f35caa588c92216882d2c737dd74fda8e967e8a3904e4bab062f

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require 'tataru'

describe Tataru::Representations::HashRepresentation do
  it 'has no dependencies for empty array' do
    rep = Tataru::Representations::HashRepresentation.new({})
    expect(rep.dependencies).to eq []
  end

  it 'has no dependencies for array with only literals' do
    rep = Tataru::Representations::HashRepresentation.new({'greeting' => 'hi'})
    expect(rep.dependencies).to eq []
  end

  it 'has dependencies for each resource' do
    rr = Tataru::Representations::ResourceRepresentation.new('file', Tataru::BaseResourceDesc.new, {})
    rep = Tataru::Representations::HashRepresentation.new(thing: rr)
    expect(rep.dependencies).to eq ['file']
  end

  it 'has dependencies for every resource' do
    rr1 = Tataru::Representations::ResourceRepresentation.new('file1', Tataru::BaseResourceDesc.new, {})
    rr2 = Tataru::Representations::ResourceRepresentation.new('file2', Tataru::BaseResourceDesc.new, {})
    rep = Tataru::Representations::HashRepresentation.new(thing1: rr1, thing2: rr2, text: 'hello')
    
    expect(rep.dependencies).to eq ['file1', 'file2']
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tataru-0.2.0 spec/representations/hash_representation_spec.rb