Sha256: 2c8b7dfd0991c870ac040a2e9f5d2b8af23559aa6741d837d1eb04f16b39e06b

Contents?: true

Size: 1.16 KB

Versions: 10

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe OpenStudio::Analysis::SupportFiles do
  before :all do
    @s = OpenStudio::Analysis::SupportFiles.new
    expect(@s).to be_a OpenStudio::Analysis::SupportFiles
  end

  it 'should add files' do
    f = 'spec/files/worker_init/first_file.rb'
    @s.add(f)

    expect(@s.size).to eq 1
    expect(@s.files.first[:file]).to eq f

    # add some other items
    @s.add('spec/files/worker_init/second_file.rb')

    expect(@s.size).to eq 2
    @s.each do |f|
      expect(f).to_not be nil
    end
  end

  it 'should remove existing items' do
    f = 'spec/files/worker_init/second_file.rb'
    @s.add(f)

    @s.clear
    expect(@s.size).to eq 0
  end

  it 'should only add existing files' do
    f = 'spec/files/worker_init/second_file.rb'
    @s.add(f)
    @s.add(f)

    expect(@s.size).to eq 1

    f = 'non-existent.rb'
    expect { @s.add(f) }.to raise_error /Path or file does not exist and cannot be added.*/
  end

  it 'should add metadata data' do
  end

  it 'should add a directory' do
    @s.clear
    @s.add_files('spec/files/measures/**/*.rb', d: 'new')

    expect(@s.size).to eq 10
    expect(@s[0][:metadata][:d]).to eq 'new'
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
openstudio-analysis-1.0.0.rc19 spec/openstudio/support_files_spec.rb
openstudio-analysis-1.0.0.rc18 spec/openstudio/support_files_spec.rb
openstudio-analysis-1.0.0.rc17 spec/openstudio/support_files_spec.rb
openstudio-analysis-1.0.0.rc16 spec/openstudio/support_files_spec.rb
openstudio-analysis-1.0.0.rc15 spec/openstudio/support_files_spec.rb
openstudio-analysis-1.0.0.rc14 spec/openstudio/support_files_spec.rb
openstudio-analysis-1.0.0.rc13 spec/openstudio/support_files_spec.rb
openstudio-analysis-1.0.0.rc12 spec/openstudio/support_files_spec.rb
openstudio-analysis-1.0.0.rc11 spec/openstudio/support_files_spec.rb
openstudio-analysis-1.0.0.rc10 spec/openstudio/support_files_spec.rb