Sha256: 913a00c504f4981b2fa9ea60c33580b8efe5afab4fa34964f73f4dc1ee6e8a78
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
$:.unshift File.dirname(__FILE__) require 'spec_helper' require 'json' include SpecHelper describe TextConverter do before do @converter = TextConverter.new @converter.stub!(:json).and_return(JSON.load(open(fixture('items.json')).read)) end it 'should convert text using a service returning plain text' do service = @converter.service('アレ') service.stub!(:get).and_return(open(fixture('are.txt')).read) @converter.stub!(:service).and_return(service) @converter.convert('アレ', 'テストです').should eql('アレです') end it 'should convert text using a service returning html' do service = @converter.service('アルベド語') service.stub!(:get).and_return(open(fixture('arubedo.html')).read) @converter.stub!(:service).and_return(service) @converter.convert('アルベド語', 'テストです').should eql('テストベヌ') end it 'should raise error if no service are found by name' do lambda { @converter.convert('FooBar', 'テストです') }.should raise_error(TextConverter::NoSuchService) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
youpy-text-converter-0.0.1 | spec/text_converter_spec.rb |
youpy-text-converter-0.0.2 | spec/text_converter_spec.rb |