spec/csl/locale/term_spec.rb in csl-1.0.0.pre11 vs spec/csl/locale/term_spec.rb in csl-1.0.0.pre12
- old
+ new
@@ -34,11 +34,44 @@
it "returns #{ordinal.inspect} for #{number}" do
en.ordinalize(number)[:name].should == ordinal
end
end
end
+
end
+ describe '#lookup' do
+
+ describe "given standard English terms" do
+ let(:en) do
+ Locale::Terms.parse <<-EOS
+ <terms>
+ <term name="page" form="short">
+ <single>p.</single>
+ <multiple>pp.</multiple>
+ </term>
+ <term name="page">
+ <single>page</single>
+ <multiple>pages</multiple>
+ </term>
+ </terms>
+ EOS
+ end
+
+ it 'returns nil if there is no matching term' do
+ en.lookup(:foo).should be_nil
+ end
+
+ it 'returns the first matching form by default' do
+ en.lookup(:page).should be_short
+ end
+
+ it 'ignores irrelevant options' do
+ en.lookup(:page, :plural => true).should_not be_nil
+ end
+ end
+
+ end
end
describe Locale::Term do
it { should_not be_nil }
\ No newline at end of file