Sha256: 69d74789c0a6a391995aa9a93521a85bae79b6f832c8e52f223cd832fb99e48b

Contents?: true

Size: 1.77 KB

Versions: 5

Compression:

Stored size: 1.77 KB

Contents

describe Evva::Config do
  subject(:config) { Evva::Config.new(hash: hash) }

  let(:hash) do
    {
      type: 'EvvaOS',
      data_source: {
        type: 'google_sheet',
        events_url: 'https://events.csv',
        people_properties_url: 'https://people_properties.csv',
        enum_classes_url: 'https://enum_classes.csv',
      },
      out_path: 'clear/path/to/event',
      event_file_name: 'event/file/name',
      event_enum_file_name: 'event/enum/file',
      people_file_name: 'people/file/name',
      people_enum_file_name: 'people/enum/file/name',
      destinations_file_name: 'destinations/file/name',
      package_name: 'com.package.name.analytics',
    }
  end

  context 'when hash is missing params' do
    before { hash.delete(:type) }
    it { expect { config }.to raise_error /missing keys/i }
  end

  its(:to_h) { should eq(hash) }
  its(:type) { should eq('EvvaOS') }
  its(:out_path) { should eq('clear/path/to/event') }
  its(:event_file_name) { should eq('event/file/name') }
  its(:event_enum_file_name) { should eq 'event/enum/file' }
  its(:people_file_name) { should eq('people/file/name') }
  its(:people_enum_file_name) { should eq('people/enum/file/name') }
  its(:destinations_file_name) { should eq 'destinations/file/name' }
  its(:package_name) { should eq 'com.package.name.analytics' }

  describe '#data_source' do
    subject(:data_source) { config.data_source }

    it { should eq(type: 'google_sheet', events_url: 'https://events.csv', people_properties_url: 'https://people_properties.csv', enum_classes_url: 'https://enum_classes.csv') }

    context 'when given an unknown type data source' do
      before { hash[:data_source] = { type: 'i_dunno' } }
      it { expect { config }.to raise_error /unknown data source type 'i_dunno'/i }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
evva-0.4.4 spec/lib/evva/config_spec.rb
evva-0.4.3 spec/lib/evva/config_spec.rb
evva-0.4.2 spec/lib/evva/config_spec.rb
evva-0.4.1 spec/lib/evva/config_spec.rb
evva-0.4.0 spec/lib/evva/config_spec.rb