spec/token_scanner_spec.rb in dentaku-1.2.0 vs spec/token_scanner_spec.rb in dentaku-1.2.1
- old
+ new
@@ -3,20 +3,20 @@
describe Dentaku::TokenScanner do
let(:whitespace) { described_class.new(:whitespace, '\s') }
let(:numeric) { described_class.new(:numeric, '(\d+(\.\d+)?|\.\d+)', lambda{|raw| raw =~ /\./ ? BigDecimal.new(raw) : raw.to_i }) }
it 'returns a token for a matching string' do
- token = whitespace.scan(' ')
+ token = whitespace.scan(' ').first
expect(token.category).to eq(:whitespace)
expect(token.value).to eq(' ')
end
it 'returns falsy for a non-matching string' do
expect(whitespace.scan('A')).not_to be
end
it 'performs raw value conversion' do
- token = numeric.scan('5')
+ token = numeric.scan('5').first
expect(token.category).to eq(:numeric)
expect(token.value).to eq(5)
end
it 'returns a list of all configured scanners' do