Sha256: 5117cc7cf5438952dd607e4c19b6f940020e933b797bb6a6c4a08f0cf709d65b

Contents?: true

Size: 908 Bytes

Versions: 1

Compression:

Stored size: 908 Bytes

Contents

# encoding: utf-8

require 'spec_helper'
require 'config_struct'

describe ConfigStruct do

  let(:basedir) { File.expand_path('../../files', __FILE__) }
  let(:basefile) { File.expand_path('../../files/config.yml', __FILE__) }
  let(:options) { { basedir: basedir, basefile: basefile } }
  let(:value1) { 'newdefault' }

  describe '.default' do
    subject { ConfigStruct.new options }
    before { subject.default :var, value1 }
    it { expect(subject.var).to eq value1 }
  end

  describe 'new' do
    context 'when there is no config file, ' do
      let(:basefile) { File.expand_path('../../files/xxx.yml', __FILE__) }
      after { FileUtils.rm basefile if File.exist? basefile }
      subject { ConfigStruct.new options }
      it 'then a config file is created calling' do
        expect(subject.basefile).to eq basefile
        expect(File.exist? basefile).to be_true
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
configstruct-0.0.1 spec/lib/config_struct_spec.rb