Sha256: 801071981887aaa66c8871099a2258e2ef0826136174590d6e7b7dcf7f1c3d61

Contents?: true

Size: 941 Bytes

Versions: 5

Compression:

Stored size: 941 Bytes

Contents

# typed: false
# frozen_string_literal: true

require './spec/spec_setup'
require 'lib/frontman/data_store'

describe Frontman::DataStore do
  subject { Frontman::DataStore.new("#{__dir__}/mocks") }

  it 'should ignore non-processable files' do
    expect(subject.asset).to eq nil
  end

  it 'should flatten' do
    expect(subject.flatten.size).to eq 4
    expect(subject.nested.flatten.size).to eq 2
  end

  it 'should access data correctly' do
    expect(subject.info.name).to eq 'test'
    expect(subject.info.types).to be_a Array
  end

  it 'should return nil when accessing nonexistent files' do
    expect(subject.non_existant).to eq nil
  end

  it 'should access parent folder' do
    expect(subject.nested.more_data.parent.base_file_name).to eq 'nested'
  end

  it 'should have name and path' do
    expect(subject.nested.base_file_name).to eq 'nested'
    expect(subject.nested.path).to eq "#{__dir__}/mocks/nested"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
frontman-ssg-0.1.1 spec/frontman/data_store_spec.rb
frontman-ssg-0.1.0 spec/frontman/data_store_spec.rb
frontman-ssg-0.0.4 spec/frontman/data_store_spec.rb
frontman-ssg-0.0.3 spec/frontman/data_store_spec.rb
frontman-ssg-0.0.2 spec/frontman/data_store_spec.rb