Last active
January 26, 2016 18:56
-
-
Save dmitryzuev/e4d056baee0b8c51be29 to your computer and use it in GitHub Desktop.
Specs for StringDecoder service object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe StringDecoder do | |
let(:decoder) { StringDecoder.new } | |
it 'decodes numeric string' do | |
input = '1231412353' | |
expect(decoder.call(input)).to equal(1231412353.0) | |
end | |
it 'decodes numeric string with spaces' do | |
input = '1 412 935 315' | |
expect(decoder.call(input)).to equal(1412935315.0) | |
end | |
it 'decodes numeric string with punctuation' do | |
input = '1,426,233,234.43' | |
expect(decoder.call(input)).to equal(1426233234.43) | |
end | |
it 'decodes string with миллиард миллион тысяча' do | |
input = '1 billion 149 millions 51 thousand' | |
expect(decoder.call(input)).to equal(1149051000.0) | |
end | |
it 'decodes string with punctuatuin and words' do | |
input = '1.44 billions' | |
expect(decoder.call(input)).to equal(1440000000.0) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment