repository_helper_spec.rb
1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require 'spec_helper'
describe RepositoryHelper do
describe 'periodicity_options' do
it 'should return an array with some sample periods' do
helper.periodicity_options.should eq [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]]
end
end
describe 'license_options' do
it 'should return an array with some sample licenses names' do
helper.license_options.should eq YAML.load_file("config/licenses.yml").split("; ")
end
end
describe 'periodicity_option' do
it 'should return the periodicity option associated to the given number' do
helper.periodicity_option(1).should eq "1 day"
end
it 'should return Undefined when there is no periodicity value' do
helper.periodicity_option(nil).should eq "Undefined"
end
end
describe 'calendar' do
it 'should return an array with the number of days' do
days = (1..31).to_a.map {|day| [day, day]}
helper.day_options.should eq days
end
it 'should return an array with the number of months' do
months = (1..12).to_a.map {|month| [month, month]}
helper.month_options.should eq months
end
it 'should return a range of years' do
years = (2013..2020).to_a.map {|year| [year, year]}
helper.year_options.should eq years
end
end
end