aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorCarlos Goce <carlosgoce@gmail.com>2015-01-23 00:07:05 +0100
committerCarlos Goce <carlosgoce@gmail.com>2015-01-23 00:07:05 +0100
commit2d10c61b2f1d43fa98b46bdd17cfce86da95b7e5 (patch)
treeac09ce9874f52e363799df319255f29a94ed36ba /spec
parente8341ef9884861fc24040d4f219a271ae1022722 (diff)
downloadpdf-calendars-2d10c61b2f1d43fa98b46bdd17cfce86da95b7e5.tar.gz
pdf-calendars-2d10c61b2f1d43fa98b46bdd17cfce86da95b7e5.tar.bz2
pdf-calendars-2d10c61b2f1d43fa98b46bdd17cfce86da95b7e5.zip
Calendar can localize months
Diffstat (limited to 'spec')
-rw-r--r--spec/calendar_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/calendar_spec.rb b/spec/calendar_spec.rb
index a543dbe..71252b3 100644
--- a/spec/calendar_spec.rb
+++ b/spec/calendar_spec.rb
@@ -1,13 +1,27 @@
require 'rspec'
+require 'rspec/expectations'
require_relative '../lib/carlosgoce/calendar'
+I18n.load_path = Dir['config/locales/*.yml']
+I18n.backend.load_translations
+
describe 'Calendar' do
before(:each) do
@calendar = CarlosGoce::Calendar.new
end
+ it 'should be initialized with the current year' do
+ expect(@calendar.year).to eq(Date.today.year)
+ end
+
describe 'Return months and days of given year' do
+ it 'should have all months of the year' do
+ expect(@calendar.to_h.count).to eq(12)
+ end
+
it 'localize month names' do
+ expect(@calendar.to_h.keys.first.to_s).to eq('january')
+ I18n.locale = 'es'
expect(@calendar.to_h.keys.first.to_s).to eq('enero')
end
end