Sha256: 336a69cb524e4920b222a887fc4d6d95fa402b99d5f6118bca8ef11d06df381b
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
# encoding: UTF-8 require 'spec_helper' include Rosette::Core describe ExtractorConfig do let(:extractor_class) { Rosette::Extractors::Test::TestExtractor } let(:extractor_id) { 'test/test' } it 'instantiates the extractor given' do ExtractorConfig.new(extractor_id, extractor_class).tap do |config| expect(config.extractor).to be_instance_of(extractor_class) expect(config.extractor_id).to eq(extractor_id) end end it 'sets a default encoding' do ExtractorConfig.new(extractor_id, extractor_class).tap do |config| expect(config.encoding).to eq(Rosette::Core::DEFAULT_ENCODING) end end describe '#set_encoding' do let(:config) { ExtractorConfig.new(extractor_id, extractor_class) } it 'sets the encoding on the instance' do config.set_encoding(Encoding::UTF_16BE).tap do |config_with_encoding| expect(config_with_encoding).to be(config) expect(config_with_encoding.encoding).to eq(Encoding::UTF_16BE) end end end describe '#matches?' do let(:config) { ExtractorConfig.new(extractor_id, extractor_class) } it 'delegates #matches? to root' do config.set_conditions do |cond| cond.match_regex(/values-(ja|de)/) end expect(config.matches?('MyProject/stuff/values-ja')).to be_truthy expect(config.matches?('MyProject/stuff/values-pt')).to be_falsey end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rosette-core-1.0.1 | spec/core/extractor/extractor_config_spec.rb |