aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorCarlos Goce <carlosgoce@gmail.com>2015-01-24 22:36:48 +0100
committerCarlos Goce <carlosgoce@gmail.com>2015-01-24 22:36:48 +0100
commit70f634dc12cbc6e9fde6c0bc8854da0ae704b906 (patch)
tree14c2fca7e19d73de8c4ec4deaf275251d1b26e5f /spec
parent47a55ef9ca277fcbce1ad1e908eb2110c2da57b4 (diff)
downloadpdf-calendars-70f634dc12cbc6e9fde6c0bc8854da0ae704b906.tar.gz
pdf-calendars-70f634dc12cbc6e9fde6c0bc8854da0ae704b906.tar.bz2
pdf-calendars-70f634dc12cbc6e9fde6c0bc8854da0ae704b906.zip
Improve data structure
Diffstat (limited to 'spec')
-rw-r--r--spec/calendar_spec.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/spec/calendar_spec.rb b/spec/calendar_spec.rb
index 8d8e346..2dc7dc3 100644
--- a/spec/calendar_spec.rb
+++ b/spec/calendar_spec.rb
@@ -18,34 +18,34 @@ describe 'Calendar' do
describe 'Return a data structure with all needed data to generate a pdf' do
it 'should have all months of the year' do
- expect(@calendar.to_h.count).to eq(12)
+ expect(@calendar.to_h[:months].count).to eq(12)
end
it 'return month names localized' do
- expect(@calendar.to_h[1][:name]).to eq 'january'
+ expect(@calendar.to_h[:months][1][:name]).to eq 'january'
I18n.locale = 'es'
- expect(@calendar.to_h[1][:name]).to eq 'enero'
+ expect(@calendar.to_h[:months][1][:name]).to eq 'enero'
end
it 'return the numbers of available days for each month' do
- expect(@calendar.to_h[1][:days]).to eq (1..31).to_a
+ expect(@calendar.to_h[:months][1][:days]).to eq (1..31).to_a
end
it 'return the days as names' do
- expect(@calendar.to_h[1][:days_names].first).to eq 'thursday'
- expect(@calendar.to_h[1][:days_names].count).to eq 31
+ expect(@calendar.to_h[:months][1][:days_names].first).to eq 'thursday'
+ expect(@calendar.to_h[:months][1][:days_names].count).to eq 31
end
it 'return the day names localized' do
- expect(@calendar.to_h[1][:days_names].first).to eq 'thursday'
+ expect(@calendar.to_h[:months][1][:days_names].first).to eq 'thursday'
I18n.locale = 'es'
- expect(@calendar.to_h[1][:days_names].first).to eq 'jueves'
+ expect(@calendar.to_h[:months][1][:days_names].first).to eq 'jueves'
end
# todo Improve spec description
it 'return the days available formated as array leaving blank days for the starting week\'s day' do
days_for_january_2015 = ['', '', ''] + (1..31).to_a
- expect(@calendar.to_h[:formatted_days].first).to eq days_for_january_2015
+ expect(@calendar.to_h[:months][1][:formatted_days].first).to eq days_for_january_2015
end
end