Sha256: 7001a870035e6e029ee77dede7ed648f30c7771961140ca240b304c2f53e764f

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

require_relative 'remi_spec'

describe Remi::Parser do
  let(:field_symbolizer) { double('field_symbolizer') }
  let(:context) { double('context') }
  let(:fields) { double('fields') }
  let(:parser) { Parser.new(context: context, fields: fields, field_symbolizer: field_symbolizer) }

  context '#parse' do
    it 'has a parse method' do
      expect(parser).respond_to? :parse
    end
  end

  context '#field_symbolizer' do
    it 'can be set in the constructor' do
      expect(parser.field_symbolizer).to eq field_symbolizer
    end

    it 'the field_symbolizer defined in the context takes priority' do
      symbolizer_from_context = double('symbolizer_from_context')
      allow(context).to receive(:field_symbolizer) { symbolizer_from_context }
      expect(parser.field_symbolizer).to eq symbolizer_from_context
    end
  end

  context '#fields' do
    it 'can be set in the constructor' do
      expect(parser.fields).to eq fields
    end

    it 'the field_symbolizer defined in the context takes priority' do
      fields_from_context = double('fields_from_context')
      allow(context).to receive(:fields) { fields_from_context }
      expect(parser.fields).to eq fields_from_context
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
remi-0.3.3 spec/parser_spec.rb
remi-0.3.2 spec/parser_spec.rb
remi-0.3.1 spec/parser_spec.rb
remi-0.3.0 spec/parser_spec.rb