Sha256: 6c61abfd2136a6d19c59cb3c6472b828b577856e38320f3c134f727828f99000
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
Contents
require 'spec_helper' describe CharDet do before(:each) do @unknown = CharDet.detect("a random string") end it "should have two accessor methods" do lambda { @unknown.encoding @unknown.confidence }.should_not raise_error(NoMethodError) end it "should return the right content" do @unknown.encoding.should eq("ascii") @unknown.confidence.should be_instance_of(Float) end it "should return a nice message if nil is being passed" do lambda { CharDet.detect(nil) }.should raise_error(Exception, "Sorry, we can't guess the encoding on a nil object") end it "should not raise an exception when passing an empty string" do lambda { CharDet.detect("") }.should_not raise_error(Exception) end it "should be possible to make detect silent" do lambda { unknown = CharDet.detect(nil, :silent => true) unknown.encoding.should be_empty unknown.confidence.should eq(0.0) }.should_not raise_error(Exception) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rchardet19-1.3.7 | spec/rchardet19_spec.rb |
rchardet19-1.3.6 | spec/rchardet19_spec.rb |
rchardet19-1.3.5 | spec/rchardet19_spec.rb |