Sha256: 8cdab48ef45e9de3ffd18587e27c8afe97cb839a3192e12aee697cbf00f49651
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
# -*- coding: utf-8 -*- require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "Dependency" do before(:all) do YaCan.appid = ENV['YAHOO_API_APPID'] @phrase = 'うちの庭には二羽鶏が居ます。' @xml = File.open(File.expand_path(File.dirname(__FILE__) + '/test_source/dependency.xml')).read end it 'should analyze sentence' do YaCan::YahooAPI.stub!(:request).and_return @xml res = YaCan::Dependency.analyze(@phrase) end it 'should have alias method :parse' do YaCan::Dependency.parse(@phrase).chunks.to_s.should == YaCan::Dependency.analyze(@phrase).chunks.to_s end it 'should have module name shortened' do YaCan::Dependency.should == YaCan::DA end describe "Result" do before(:all) do @result = YaCan::Dependency::Result.new(@xml) end it 'should have chunks' do @result.chunks.should have(4).items end it 'should be gettable a chunk from dependency' do @result.chunks.first.depends_on.id.should == 1 @result.chunks.last.depends_on.should == nil end it 'should be gettable chunks from a chunk depends from' do @result.chunks.last.depends_from.map{ |c| c.id }.should == [1,2] @result.chunks.first.depends_from.should be_empty end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yacan-0.1.1 | spec/dependency_spec.rb |
yacan-0.1.0 | spec/dependency_spec.rb |