Permalink
Browse files

with_locale now returns yielded value, added spec

  • Loading branch information...
Cameron Dutro
Cameron Dutro committed Dec 14, 2012
1 parent 4cc8046 commit 14cfd70f95d100ef2f745cdfe667dd5bdc2df67e
Showing with 9 additions and 2 deletions.
  1. +1 −2 lib/twitter_cldr.rb
  2. +8 −0 spec/twitter_cldr_spec.rb
View
@@ -16,8 +16,7 @@
require 'twitter_cldr/version'
Enumerator = Enumerable::Enumerator unless defined?(Enumerator)
-require 'pry'
-require 'pry-nav'
+
module TwitterCldr
autoload :Formatters, 'twitter_cldr/formatters'
@@ -271,6 +271,14 @@
end
end
+ describe "#with_locale" do
+ it "should only change the locale in the context of the block" do
+ TwitterCldr::Shared::Languages.from_code(:es).should == "Spanish"
+ TwitterCldr.with_locale(:es) { TwitterCldr::Shared::Languages.from_code(:es) }.should match_normalized("español")
+ TwitterCldr::Shared::Languages.from_code(:es).should == "Spanish"
+ end
+ end
+
describe '#resources' do
it 'returns @resources' do
resources = TwitterCldr::Resources::Loader.new

0 comments on commit 14cfd70

Please sign in to comment.