spec/collation_spec.rb in ffi-icu-0.0.5 vs spec/collation_spec.rb in ffi-icu-0.0.6
- old
+ new
@@ -2,28 +2,36 @@
require 'spec_helper'
module ICU
module Collation
+ describe "Collation" do
+ it "should collate an array of strings" do
+ Collation.collate("nb", %w[æ å ø]).should == %w[æ ø å]
+ end
+ end
+
describe Collator do
before { @c = Collator.new("nb") }
- after { @c.close }
it "should collate an array of strings" do
@c.collate(%w[å ø æ]).should == %w[æ ø å]
end
+ it "raises an error if argument does not respond to :sort" do
+ lambda { @c.collate(1) }.should raise_error(ArgumentError)
+ end
+
it "should return available locales" do
locales = ICU::Collation.available_locales
locales.should be_kind_of(Array)
locales.should_not be_empty
locales.should include("nb")
end
it "should return the locale of the collator" do
l = @c.locale
- l.should be_kind_of(String)
l.should == "nb"
end
it "should compare two strings" do
@c.compare("blåbærsyltetøy", "blah").should == 1