edtf 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,56 +4,56 @@ module EDTF
4
4
 
5
5
  describe Decade do
6
6
 
7
- it { should_not be nil }
7
+ it { is_expected.not_to be nil }
8
8
 
9
9
  describe '.current' do
10
10
  it 'creates the current decade' do
11
- Decade.current.year.should == (Time.now.year / 10) * 10
11
+ expect(Decade.current.year).to eq((Time.now.year / 10) * 10)
12
12
  end
13
13
  end
14
14
 
15
15
  describe '#min' do
16
16
  it 'the year 1990 should be the minimum of the 1990s' do
17
- Decade.new(1999).min.should == Date.new(1990).year_precision!
17
+ expect(Decade.new(1999).min).to eq(Date.new(1990).year_precision!)
18
18
  end
19
19
  end
20
20
 
21
21
  describe '#max' do
22
22
  it 'the year 1999 should be the maximum of the 1990s' do
23
- Decade.new(1999).max.should == Date.new(1999).year_precision!
23
+ expect(Decade.new(1999).max).to eq(Date.new(1999).year_precision!)
24
24
  end
25
25
 
26
26
  it 'has year precision' do
27
- Decade.new(1999).max.should be_year_precision
27
+ expect(Decade.new(1999).max).to be_year_precision
28
28
  end
29
29
  end
30
30
 
31
31
  describe '#cover?' do
32
32
  it '1989-12-31 should be covered by the 1980s' do
33
- Decade.new(1980).should be_cover(Date.new(1989,12,31))
33
+ expect(Decade.new(1980)).to be_cover(Date.new(1989,12,31))
34
34
  end
35
35
  end
36
36
 
37
37
  describe '#to_range' do
38
38
 
39
39
  it 'returns a range' do
40
- Decade.new.to_range.should be_instance_of(::Range)
40
+ expect(Decade.new.to_range).to be_instance_of(::Range)
41
41
  end
42
42
 
43
43
  it 'the range starts with a date object' do
44
- Decade.new.to_range.begin.should be_instance_of(::Date)
44
+ expect(Decade.new.to_range.begin).to be_instance_of(::Date)
45
45
  end
46
46
 
47
47
  it 'the range ends with a date object' do
48
- Decade.new.to_range.end.should be_instance_of(::Date)
48
+ expect(Decade.new.to_range.end).to be_instance_of(::Date)
49
49
  end
50
50
 
51
51
  it 'the range start has year precision' do
52
- Decade.new.to_range.begin.should be_year_precision
52
+ expect(Decade.new.to_range.begin).to be_year_precision
53
53
  end
54
54
 
55
55
  it 'the range end has year precision' do
56
- Decade.new.to_range.end.should be_year_precision
56
+ expect(Decade.new.to_range.end).to be_year_precision
57
57
  end
58
58
 
59
59
  end
@@ -61,11 +61,11 @@ module EDTF
61
61
  describe 'enumeration' do
62
62
 
63
63
  it 'always covers ten years' do
64
- Decade.new.to_a.should have(10).elements
64
+ expect(Decade.new.to_a.size).to eq(10)
65
65
  end
66
66
 
67
67
  it 'the 1970s should map to the years [1970, 1971, ... , 1979]' do
68
- Decade.new(1970).map(&:year).should == [1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979]
68
+ expect(Decade.new(1970).map(&:year)).to eq([1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979])
69
69
  end
70
70
 
71
71
  end
@@ -74,11 +74,11 @@ module EDTF
74
74
 
75
75
  describe Century do
76
76
 
77
- it { should_not be nil }
77
+ it { is_expected.not_to be nil }
78
78
 
79
79
  describe '.current' do
80
80
  it 'creates the current century' do
81
- Century.current.year.should == (Time.now.year / 100) * 100
81
+ expect(Century.current.year).to eq((Time.now.year / 100) * 100)
82
82
  end
83
83
  end
84
84
 
@@ -4,58 +4,58 @@ module EDTF
4
4
  describe 'the interval 2008/2011' do
5
5
  let(:interval) { Date.edtf('2008/2011') }
6
6
 
7
- it { interval.should_not be_open }
8
- it { interval.should_not be_open_end }
9
- it { interval.should_not be_unknown_start }
10
- it { interval.should_not be_unknown_end }
7
+ it { expect(interval).not_to be_open }
8
+ it { expect(interval).not_to be_open_end }
9
+ it { expect(interval).not_to be_unknown_start }
10
+ it { expect(interval).not_to be_unknown_end }
11
11
 
12
12
  it 'has a length of 4' do
13
- interval.to_a.length.should == 4
13
+ expect(interval.to_a.length).to eq(4)
14
14
  end
15
15
 
16
16
  it '#step(2) yields the years 2008 and 2010' do
17
- interval.step(2).map(&:year).should == [2008,2010]
17
+ expect(interval.step(2).map(&:year)).to eq([2008,2010])
18
18
  end
19
19
 
20
20
  it 'the max date is 2011-12-31' do
21
- interval.max.to_s.should == '2011-12-31'
21
+ expect(interval.max.to_s).to eq('2011-12-31')
22
22
  end
23
23
 
24
24
  it 'the max date has year precision' do
25
- interval.max.should be_year_precision
25
+ expect(interval.max).to be_year_precision
26
26
  end
27
27
 
28
28
  it 'the min date is 2008-01-01' do
29
- interval.min.to_s.should == '2008-01-01'
29
+ expect(interval.min.to_s).to eq('2008-01-01')
30
30
  end
31
31
 
32
32
  it 'the min date has year precision' do
33
- interval.min.should be_year_precision
33
+ expect(interval.min).to be_year_precision
34
34
  end
35
35
 
36
36
 
37
37
  it 'includes the years 2008, 2009, 2010 and 2011' do
38
- interval.to_a.map(&:year).should == [2008, 2009, 2010, 2011]
38
+ expect(interval.to_a.map(&:year)).to eq([2008, 2009, 2010, 2011])
39
39
  end
40
40
 
41
41
  it 'does not include christmas day 2009' do
42
- interval.should_not be_include(Date.new(2009,12,24))
42
+ expect(interval).not_to be_include(Date.new(2009,12,24))
43
43
  end
44
44
 
45
45
  it 'christmas day 2009 is less than max' do
46
- Date.new(2009,12,24).should < interval.max
46
+ expect(Date.new(2009,12,24)).to be < interval.max
47
47
  end
48
48
 
49
49
  it 'christmas day 2009 is greater than min' do
50
- Date.new(2009,12,24).should > interval.min
50
+ expect(Date.new(2009,12,24)).to be > interval.min
51
51
  end
52
52
 
53
53
  it 'covers christmas day 2009' do
54
- interval.should be_cover(Date.new(2009,12,24))
54
+ expect(interval).to be_cover(Date.new(2009,12,24))
55
55
  end
56
56
 
57
57
  it 'covers 2011-12-31' do
58
- interval.should be_cover(Date.new(2011,12,31))
58
+ expect(interval).to be_cover(Date.new(2011,12,31))
59
59
  end
60
60
  end
61
61
 
@@ -63,72 +63,72 @@ module EDTF
63
63
  let(:interval) { Date.edtf('2008-08-23/2011-07-01') }
64
64
 
65
65
  it 'includes christmas day 2009' do
66
- interval.should be_include(Date.new(2009,12,24))
66
+ expect(interval).to be_include(Date.new(2009,12,24))
67
67
  end
68
68
 
69
69
  it 'covers christmas day 2009' do
70
- interval.should be_cover(Date.new(2009,12,24))
70
+ expect(interval).to be_cover(Date.new(2009,12,24))
71
71
  end
72
72
 
73
73
  it 'does not cover 2011-07-02' do
74
- interval.should_not be_cover(Date.new(2011,07,02))
74
+ expect(interval).not_to be_cover(Date.new(2011,07,02))
75
75
  end
76
76
  end
77
77
 
78
78
  describe 'the interval 2008-08-23/open' do
79
79
  let(:interval) { Date.edtf('2008-08-23/open') }
80
80
 
81
- it { interval.should be_open }
82
- it { interval.should be_open_end }
83
- it { interval.should_not be_unknown }
84
- it { interval.should_not be_unknown_start }
85
- it { interval.should_not be_unknown_end }
81
+ it { expect(interval).to be_open }
82
+ it { expect(interval).to be_open_end }
83
+ it { expect(interval).not_to be_unknown }
84
+ it { expect(interval).not_to be_unknown_start }
85
+ it { expect(interval).not_to be_unknown_end }
86
86
 
87
87
  it 'the min date is 2008-08-23' do
88
- interval.min.should == Date.new(2008,8,23)
88
+ expect(interval.min).to eq(Date.new(2008,8,23))
89
89
  end
90
90
 
91
91
  it 'the max date is nil' do
92
- interval.max.should be nil
92
+ expect(interval.max).to be nil
93
93
  end
94
94
 
95
95
  it 'includes christmas day 2009' do
96
- interval.should be_include(Date.new(2009,12,24))
96
+ expect(interval).to be_include(Date.new(2009,12,24))
97
97
  end
98
98
 
99
99
  it 'covers christmas day 2009' do
100
- interval.should be_cover(Date.new(2009,12,24))
100
+ expect(interval).to be_cover(Date.new(2009,12,24))
101
101
  end
102
102
 
103
103
  it 'covers 2023-07-02' do
104
- interval.should be_cover(Date.new(2023,07,02))
104
+ expect(interval).to be_cover(Date.new(2023,07,02))
105
105
  end
106
106
 
107
107
  end
108
108
 
109
109
  describe 'comparisions' do
110
110
  it '2007/2009 should be greater than 2001/2002' do
111
- Date.edtf('2007/2009').should > Date.edtf('2001/2002')
111
+ expect(Date.edtf('2007/2009')).to be > Date.edtf('2001/2002')
112
112
  end
113
113
 
114
114
  it '2007/2009 should be less than 2011/2012' do
115
- Date.edtf('2007/2009').should < Date.edtf('2011/2012')
115
+ expect(Date.edtf('2007/2009')).to be < Date.edtf('2011/2012')
116
116
  end
117
117
 
118
118
  it '2007/2009 should be less than 2008/2009' do
119
- Date.edtf('2007/2009').should < Date.edtf('2008/2009')
119
+ expect(Date.edtf('2007/2009')).to be < Date.edtf('2008/2009')
120
120
  end
121
121
 
122
122
  it '2007/2009 should be greater than 2007/2008' do
123
- Date.edtf('2007/2009').should > Date.edtf('2007/2008')
123
+ expect(Date.edtf('2007/2009')).to be > Date.edtf('2007/2008')
124
124
  end
125
125
 
126
126
  it '2007/2009 should be greater than 2006/2007' do
127
- Date.edtf('2007/2009').should > Date.edtf('2006/2007')
127
+ expect(Date.edtf('2007/2009')).to be > Date.edtf('2006/2007')
128
128
  end
129
129
 
130
130
  it '2007/2009 should be equal to 2007/2009' do
131
- Date.edtf('2007/2009').should == Date.edtf('2007/2009')
131
+ expect(Date.edtf('2007/2009')).to eq(Date.edtf('2007/2009'))
132
132
  end
133
133
  end
134
134
 
@@ -3,349 +3,349 @@ module EDTF
3
3
  describe '#parse' do
4
4
 
5
5
  it 'parses simple dates "2001-02-03"' do
6
- Parser.new.parse('2001-02-03').to_s.should == '2001-02-03'
6
+ expect(Parser.new.parse('2001-02-03').to_s).to eq('2001-02-03')
7
7
  end
8
8
 
9
9
  it 'parses negative years' do
10
- Parser.new.parse('-2323').to_s.should == '-2323-01-01'
10
+ expect(Parser.new.parse('-2323').to_s).to eq('-2323-01-01')
11
11
  end
12
12
 
13
13
  it 'parses the negative year -2101 and sets the precision to :year' do
14
- Parser.new.parse('-2101').should be_year_precision
14
+ expect(Parser.new.parse('-2101')).to be_year_precision
15
15
  end
16
16
 
17
17
  it 'parses year zero' do
18
- Parser.new.parse('0000').to_s.should == '0000-01-01'
18
+ expect(Parser.new.parse('0000').to_s).to eq('0000-01-01')
19
19
  end
20
20
 
21
21
  it 'parses date/time with time zones' do
22
- Parser.new.parse('2011-08-15T11:19:00+01:00').to_s.should == '2011-08-15T11:19:00+01:00'
22
+ expect(Parser.new.parse('2011-08-15T11:19:00+01:00').to_s).to eq('2011-08-15T11:19:00+01:00')
23
23
  end
24
24
 
25
25
  it 'parses simple intervals like "2007/2008"' do
26
- Parser.new.parse('2007/2008').should be_a(Interval)
26
+ expect(Parser.new.parse('2007/2008')).to be_a(Interval)
27
27
  end
28
28
 
29
29
  it 'parses uncertain dates' do
30
- Parser.new.parse('1984?').should be_uncertain
31
- Parser.new.parse('1984').should be_certain
30
+ expect(Parser.new.parse('1984?')).to be_uncertain
31
+ expect(Parser.new.parse('1984')).to be_certain
32
32
  end
33
33
 
34
34
  it 'parses uncertain dates (day precision)' do
35
- Parser.new.parse('1984-11-23?').should be_uncertain
36
- Parser.new.parse('1984-11-23').should be_certain
35
+ expect(Parser.new.parse('1984-11-23?')).to be_uncertain
36
+ expect(Parser.new.parse('1984-11-23')).to be_certain
37
37
  end
38
38
 
39
39
  it 'parses approximate dates' do
40
- Parser.new.parse('1984-01~').should be_approximate
41
- Parser.new.parse('1984-01').should be_precise
40
+ expect(Parser.new.parse('1984-01~')).to be_approximate
41
+ expect(Parser.new.parse('1984-01')).to be_precise
42
42
  end
43
43
 
44
44
  it 'parses uncertain approximate dates' do
45
- Parser.new.parse('1984?~').should be_uncertain
46
- Parser.new.parse('1984?~').should be_approximate
45
+ expect(Parser.new.parse('1984?~')).to be_uncertain
46
+ expect(Parser.new.parse('1984?~')).to be_approximate
47
47
  end
48
48
 
49
49
  it 'parses unspecified dates' do
50
- Parser.new.parse('199u').should be_unspecified
51
- Parser.new.parse('1999-uu-uu').should be_unspecified
50
+ expect(Parser.new.parse('199u')).to be_unspecified
51
+ expect(Parser.new.parse('1999-uu-uu')).to be_unspecified
52
52
  end
53
53
 
54
54
  it 'parses open intervals' do
55
- Parser.new.parse('2004-01-01/open').should be_open
55
+ expect(Parser.new.parse('2004-01-01/open')).to be_open
56
56
  end
57
57
 
58
58
  it 'parses unknown intervals' do
59
- Parser.new.parse('2004-01-01/unknown').should be_unknown_end
60
- Parser.new.parse('unknown/2004-01-01').should be_unknown_start
59
+ expect(Parser.new.parse('2004-01-01/unknown')).to be_unknown_end
60
+ expect(Parser.new.parse('unknown/2004-01-01')).to be_unknown_start
61
61
  end
62
62
 
63
63
  it 'parses intervals with uncertain or approximate dates' do
64
- Parser.new.parse('1984-06-02?/2004-08-08~').from.should be_uncertain
65
- Parser.new.parse('1984-06-02?/2004-08-08~').to.should be_approximate
64
+ expect(Parser.new.parse('1984-06-02?/2004-08-08~').from).to be_uncertain
65
+ expect(Parser.new.parse('1984-06-02?/2004-08-08~').to).to be_approximate
66
66
  end
67
67
 
68
68
  it 'parses positive long years' do
69
- Parser.new.parse('y170000002').year.should == 170000002
69
+ expect(Parser.new.parse('y170000002').year).to eq(170000002)
70
70
  end
71
71
 
72
72
  it 'parses negative long years' do
73
- Parser.new.parse('y-170000002').year.should == -170000002
73
+ expect(Parser.new.parse('y-170000002').year).to eq(-170000002)
74
74
  end
75
75
 
76
76
  it 'parses season codes' do
77
- Parser.new.parse('2003-23').should be_autumn
77
+ expect(Parser.new.parse('2003-23')).to be_autumn
78
78
  end
79
79
 
80
80
  it 'parses calendar names' do
81
- Parser.new.parse('2001-02-03^xyz').calendar.should == 'xyz'
81
+ expect(Parser.new.parse('2001-02-03^xyz').calendar).to eq('xyz')
82
82
  end
83
83
 
84
84
  it 'parses season qualifiers' do
85
85
  d = Parser.new.parse('2003-23^european')
86
- d.should be_autumn
87
- d.should be_qualified
88
- d.qualifier.should == 'european'
86
+ expect(d).to be_autumn
87
+ expect(d).to be_qualified
88
+ expect(d.qualifier).to eq('european')
89
89
  end
90
90
 
91
91
  it 'parses uncertain seasons' do
92
- Parser.new.parse!('2003-23?').should be_uncertain
92
+ expect(Parser.new.parse!('2003-23?')).to be_uncertain
93
93
  end
94
94
 
95
95
  it 'parses approximate seasons' do
96
- Parser.new.parse!('2003-23~').should be_approximate
96
+ expect(Parser.new.parse!('2003-23~')).to be_approximate
97
97
  end
98
98
 
99
99
  it 'parses uncertain and approximate seasons' do
100
- Parser.new.parse!('2003-23?~').should be_uncertain
101
- Parser.new.parse!('2003-23?~').should be_approximate
100
+ expect(Parser.new.parse!('2003-23?~')).to be_uncertain
101
+ expect(Parser.new.parse!('2003-23?~')).to be_approximate
102
102
  end
103
103
 
104
104
 
105
105
  it 'parses positive scientific long years' do
106
- Parser.new.parse('y17e7').year.should == 170000000
106
+ expect(Parser.new.parse('y17e7').year).to eq(170000000)
107
107
  end
108
108
 
109
109
  it 'parses negative scientific long years' do
110
- Parser.new.parse('y-17e7').year.should == -170000000
110
+ expect(Parser.new.parse('y-17e7').year).to eq(-170000000)
111
111
  end
112
112
 
113
113
  it 'parses masked precision date strings (decades)' do
114
114
  d = Parser.new.parse!('198x')
115
- d.should be_cover(Date.new(1983,3,12))
116
- d.should_not be_cover(Date.new(1990,1,1))
115
+ expect(d).to be_cover(Date.new(1983,3,12))
116
+ expect(d).not_to be_cover(Date.new(1990,1,1))
117
117
  end
118
118
 
119
119
  it 'parses masked precision date strings (centuries)' do
120
120
  d = Parser.new.parse!('18xx')
121
- d.should be_cover(Date.new(1848,1,14))
122
- d.should_not be_cover(Date.new(1799,12,31))
121
+ expect(d).to be_cover(Date.new(1848,1,14))
122
+ expect(d).not_to be_cover(Date.new(1799,12,31))
123
123
  end
124
124
 
125
125
  it 'parses multiple dates (years)' do
126
126
  d = Parser.new.parse!('{1667,1668, 1670..1672}')
127
- d.map(&:year).should == [1667,1668,1670,1671,1672]
127
+ expect(d.map(&:year)).to eq([1667,1668,1670,1671,1672])
128
128
  end
129
129
 
130
130
  it 'parses multiple dates (mixed years and months)' do
131
131
  d = Parser.new.parse!('{1960, 1961-12}')
132
- d.map { |x| [x.year,x.month] }.should == [[1960,1],[1961,12]]
132
+ expect(d.map { |x| [x.year,x.month] }).to eq([[1960,1],[1961,12]])
133
133
  end
134
134
 
135
135
  it 'parses choice lists (One of the years 1667, 1668, 1670, 1671, 1672)' do
136
136
  d = Parser.new.parse!('[1667,1668, 1670..1672]')
137
- d.map(&:year).should == [1667,1668,1670,1671,1672]
137
+ expect(d.map(&:year)).to eq([1667,1668,1670,1671,1672])
138
138
  end
139
139
 
140
140
  it 'parses choice lists (December 3, 1760 or some earlier date)' do
141
141
  d = Parser.new.parse!('[..1760-12-03]')
142
- d.map(&:to_s).should == ['1760-12-03']
142
+ expect(d.map(&:to_s)).to eq(['1760-12-03'])
143
143
  end
144
144
 
145
145
  it 'parses choice lists (December 1760 or some later month)' do
146
146
  d = Parser.new.parse!('[1760-12..]')
147
- d.map { |x| [x.year,x.month] }.should == [[1760,12]]
147
+ expect(d.map { |x| [x.year,x.month] }).to eq([[1760,12]])
148
148
  end
149
149
 
150
150
  it 'parses choice lists (January or February of 1760 or December 1760 or some later month)' do
151
151
  d = Parser.new.parse!('[1760-01, 1760-02, 1760-12..]')
152
- d.length.should == 3
152
+ expect(d.length).to eq(3)
153
153
  end
154
154
 
155
155
  it 'parses intern unspecified "199u-01-01"' do
156
- Parser.new.parse!('199u-01-01').unspecified.to_s.should == 'sssu-ss-ss'
156
+ expect(Parser.new.parse!('199u-01-01').unspecified.to_s).to eq('sssu-ss-ss')
157
157
  end
158
158
 
159
159
  it 'parses intern unspecified "19uu-01-01"' do
160
- Parser.new.parse!('19uu-01-01').unspecified.to_s.should == 'ssuu-ss-ss'
160
+ expect(Parser.new.parse!('19uu-01-01').unspecified.to_s).to eq('ssuu-ss-ss')
161
161
  end
162
162
 
163
163
  it 'parses intern unspecified "199u-uu-01"' do
164
- Parser.new.parse!('199u-uu-01').unspecified.to_s.should == 'sssu-uu-ss'
164
+ expect(Parser.new.parse!('199u-uu-01').unspecified.to_s).to eq('sssu-uu-ss')
165
165
  end
166
166
 
167
167
  it 'parses intern unspecified "19uu-uu-01"' do
168
- Parser.new.parse!('19uu-uu-01').unspecified.to_s.should == 'ssuu-uu-ss'
168
+ expect(Parser.new.parse!('19uu-uu-01').unspecified.to_s).to eq('ssuu-uu-ss')
169
169
  end
170
170
 
171
171
  it 'parses intern unspecified "199u-uu-uu"' do
172
- Parser.new.parse!('199u-uu-uu').unspecified.to_s.should == 'sssu-uu-uu'
172
+ expect(Parser.new.parse!('199u-uu-uu').unspecified.to_s).to eq('sssu-uu-uu')
173
173
  end
174
174
 
175
175
  it 'parses intern unspecified "19uu-uu-uu"' do
176
- Parser.new.parse!('19uu-uu-uu').unspecified.to_s.should == 'ssuu-uu-uu'
176
+ expect(Parser.new.parse!('19uu-uu-uu').unspecified.to_s).to eq('ssuu-uu-uu')
177
177
  end
178
178
 
179
179
  it 'parses intern unspecified "199u-01-uu"' do
180
- Parser.new.parse!('199u-01-uu').unspecified.to_s.should == 'sssu-ss-uu'
180
+ expect(Parser.new.parse!('199u-01-uu').unspecified.to_s).to eq('sssu-ss-uu')
181
181
  end
182
182
 
183
183
  it 'parses intern unspecified "19uu-01-uu"' do
184
- Parser.new.parse!('19uu-01-uu').unspecified.to_s.should == 'ssuu-ss-uu'
184
+ expect(Parser.new.parse!('19uu-01-uu').unspecified.to_s).to eq('ssuu-ss-uu')
185
185
  end
186
186
 
187
187
  it 'parses intern unspecified "1999-uu-01"' do
188
- Parser.new.parse!('1999-uu-01').unspecified.to_s.should == 'ssss-uu-ss'
188
+ expect(Parser.new.parse!('1999-uu-01').unspecified.to_s).to eq('ssss-uu-ss')
189
189
  end
190
190
 
191
191
  it 'parses intern unspecified "2004-06-uu"' do
192
- Parser.new.parse!('2004-06-uu').unspecified.to_s.should == 'ssss-ss-uu'
192
+ expect(Parser.new.parse!('2004-06-uu').unspecified.to_s).to eq('ssss-ss-uu')
193
193
  end
194
194
 
195
195
 
196
196
  it 'parses internal unspecified interval "2004-06-uu/2004-07-03"' do
197
- Parser.new.parse!('2004-06-uu/2004-07-03').from.should == Date.new(2004,6,1)
197
+ expect(Parser.new.parse!('2004-06-uu/2004-07-03').from).to eq(Date.new(2004,6,1))
198
198
  end
199
199
 
200
200
  it 'parses "2004?-06-11": uncertain year; month, day known' do
201
201
  d = Parser.new.parse!('2004?-06-11')
202
- d.uncertain?(:year).should be true
203
- d.uncertain?([:month, :day]).should be false
202
+ expect(d.uncertain?(:year)).to be true
203
+ expect(d.uncertain?([:month, :day])).to be false
204
204
  end
205
205
 
206
206
  it 'parses "2004-06~-11": year and month are approximate; day known' do
207
207
  d = Parser.new.parse!('2004-06~-11')
208
- d.approximate?(:year).should be true
209
- d.approximate?(:month).should be true
210
- d.approximate?(:day).should be false
208
+ expect(d.approximate?(:year)).to be true
209
+ expect(d.approximate?(:month)).to be true
210
+ expect(d.approximate?(:day)).to be false
211
211
  end
212
212
 
213
213
  it 'parses "2004-(06)?-11": uncertain month, year and day known' do
214
214
  d = Parser.new.parse!('2004-(06)?-11')
215
215
 
216
- d.uncertain?(:year).should be false
217
- d.approximate?(:year).should be false
216
+ expect(d.uncertain?(:year)).to be false
217
+ expect(d.approximate?(:year)).to be false
218
218
 
219
- d.uncertain?(:month).should be true
220
- d.approximate?(:month).should be false
219
+ expect(d.uncertain?(:month)).to be true
220
+ expect(d.approximate?(:month)).to be false
221
221
 
222
- d.uncertain?(:day).should be false
223
- d.approximate?(:day).should be false
222
+ expect(d.uncertain?(:day)).to be false
223
+ expect(d.approximate?(:day)).to be false
224
224
  end
225
225
 
226
226
  it 'parses "2004-06-(11)~": day is approximate; year, month known' do
227
227
  d = Parser.new.parse!('2004-06-(11)~')
228
- d.approximate?(:year).should be false
229
- d.approximate?(:month).should be false
230
- d.approximate?(:day).should be true
228
+ expect(d.approximate?(:year)).to be false
229
+ expect(d.approximate?(:month)).to be false
230
+ expect(d.approximate?(:day)).to be true
231
231
  end
232
232
 
233
233
  it 'parses "2004-(06)?~": year known, month within year is approximate and uncertain' do
234
234
  d = Parser.new.parse!('2004-(06)?~')
235
235
 
236
- d.approximate?(:year).should be false
237
- d.uncertain?(:year).should be false
236
+ expect(d.approximate?(:year)).to be false
237
+ expect(d.uncertain?(:year)).to be false
238
238
 
239
- d.approximate?(:month).should be true
240
- d.uncertain?(:month).should be true
239
+ expect(d.approximate?(:month)).to be true
240
+ expect(d.uncertain?(:month)).to be true
241
241
 
242
- d.approximate?(:day).should be false
243
- d.uncertain?(:day).should be false
242
+ expect(d.approximate?(:day)).to be false
243
+ expect(d.uncertain?(:day)).to be false
244
244
  end
245
245
 
246
246
  it 'parses "2004-(06-11)?": year known, month and day uncertain' do
247
247
  d = Parser.new.parse!('2004-(06-11)?')
248
248
 
249
- d.approximate?(:year).should be false
250
- d.uncertain?(:year).should be false
249
+ expect(d.approximate?(:year)).to be false
250
+ expect(d.uncertain?(:year)).to be false
251
251
 
252
- d.approximate?(:month).should be false
253
- d.uncertain?(:month).should be true
252
+ expect(d.approximate?(:month)).to be false
253
+ expect(d.uncertain?(:month)).to be true
254
254
 
255
- d.approximate?(:day).should be false
256
- d.uncertain?(:day).should be true
255
+ expect(d.approximate?(:day)).to be false
256
+ expect(d.uncertain?(:day)).to be true
257
257
  end
258
258
 
259
259
  it 'parses "2004?-06-(11)~": year uncertain, month known, day approximate' do
260
260
  d = Parser.new.parse('2004?-06-(11)~')
261
261
 
262
- d.approximate?(:year).should be false
263
- d.uncertain?(:year).should be true
262
+ expect(d.approximate?(:year)).to be false
263
+ expect(d.uncertain?(:year)).to be true
264
264
 
265
- d.approximate?(:month).should be false
266
- d.uncertain?(:month).should be false
265
+ expect(d.approximate?(:month)).to be false
266
+ expect(d.uncertain?(:month)).to be false
267
267
 
268
- d.approximate?(:day).should be true
269
- d.uncertain?(:day).should be false
268
+ expect(d.approximate?(:day)).to be true
269
+ expect(d.uncertain?(:day)).to be false
270
270
  end
271
271
 
272
272
  it 'parses "(2004-(06)~)?": year uncertain and month is both uncertain and approximate' do
273
273
  d = Parser.new.parse!('(2004-(06)~)?')
274
274
 
275
- d.approximate?(:year).should be false
276
- d.uncertain?(:year).should be true
275
+ expect(d.approximate?(:year)).to be false
276
+ expect(d.uncertain?(:year)).to be true
277
277
 
278
- d.approximate?(:month).should be true
279
- d.uncertain?(:month).should be true
278
+ expect(d.approximate?(:month)).to be true
279
+ expect(d.uncertain?(:month)).to be true
280
280
 
281
- d.approximate?(:day).should be false
282
- d.uncertain?(:day).should be false
281
+ expect(d.approximate?(:day)).to be false
282
+ expect(d.uncertain?(:day)).to be false
283
283
  end
284
284
 
285
285
  it 'parses "2004~-(06)?-01~": year and day approximate, month uncertain' do
286
286
  d = Parser.new.parse!("2004~-(06)?-01~")
287
287
 
288
- d.approximate?(:year).should be true
289
- d.uncertain?(:year).should be false
288
+ expect(d.approximate?(:year)).to be true
289
+ expect(d.uncertain?(:year)).to be false
290
290
 
291
- d.approximate?(:month).should be false
292
- d.uncertain?(:month).should be true
291
+ expect(d.approximate?(:month)).to be false
292
+ expect(d.uncertain?(:month)).to be true
293
293
 
294
- d.approximate?(:day).should be true
295
- d.uncertain?(:day).should be false
294
+ expect(d.approximate?(:day)).to be true
295
+ expect(d.uncertain?(:day)).to be false
296
296
  end
297
297
 
298
298
  it 'parses "2004~-(06-(01)~)?": year and day approximate, month and day uncertain' do
299
299
  d = Parser.new.parse!("2004~-(06-(01)~)?")
300
300
 
301
- d.approximate?(:year).should be true
302
- d.uncertain?(:year).should be false
301
+ expect(d.approximate?(:year)).to be true
302
+ expect(d.uncertain?(:year)).to be false
303
303
 
304
- d.approximate?(:month).should be false
305
- d.uncertain?(:month).should be true
304
+ expect(d.approximate?(:month)).to be false
305
+ expect(d.uncertain?(:month)).to be true
306
306
 
307
- d.approximate?(:day).should be true
308
- d.uncertain?(:day).should be true
307
+ expect(d.approximate?(:day)).to be true
308
+ expect(d.uncertain?(:day)).to be true
309
309
  end
310
310
 
311
311
  it 'parses "2004~-(06)?-01?~": year and day approximate, month and day uncertain' do
312
312
  d = Parser.new.parse!("2004~-(06)?-01?~")
313
313
 
314
- d.approximate?(:year).should be true
315
- d.uncertain?(:year).should be false
314
+ expect(d.approximate?(:year)).to be true
315
+ expect(d.uncertain?(:year)).to be false
316
316
 
317
- d.approximate?(:month).should be false
318
- d.uncertain?(:month).should be true
317
+ expect(d.approximate?(:month)).to be false
318
+ expect(d.uncertain?(:month)).to be true
319
319
 
320
- d.approximate?(:day).should be true
321
- d.uncertain?(:day).should be true
320
+ expect(d.approximate?(:day)).to be true
321
+ expect(d.uncertain?(:day)).to be true
322
322
  end
323
323
 
324
324
  it 'parses "2004~-(06)?": year approximate, month uncertain' do
325
325
  d = Parser.new.parse!("2004~-(06)?")
326
326
 
327
- d.approximate?(:year).should be true
328
- d.uncertain?(:year).should be false
327
+ expect(d.approximate?(:year)).to be true
328
+ expect(d.uncertain?(:year)).to be false
329
329
 
330
- d.approximate?(:month).should be false
331
- d.uncertain?(:month).should be true
330
+ expect(d.approximate?(:month)).to be false
331
+ expect(d.uncertain?(:month)).to be true
332
332
 
333
- d.approximate?(:day).should be false
334
- d.uncertain?(:day).should be false
333
+ expect(d.approximate?(:day)).to be false
334
+ expect(d.uncertain?(:day)).to be false
335
335
  end
336
336
 
337
337
 
338
338
  it 'parses "2004~-06?": year approximate, year and month uncertain' do
339
339
  d = Parser.new.parse!("2004~-06?")
340
340
 
341
- d.approximate?(:year).should be true
342
- d.uncertain?(:year).should be true
341
+ expect(d.approximate?(:year)).to be true
342
+ expect(d.uncertain?(:year)).to be true
343
343
 
344
- d.approximate?(:month).should be false
345
- d.uncertain?(:month).should be true
344
+ expect(d.approximate?(:month)).to be false
345
+ expect(d.uncertain?(:month)).to be true
346
346
 
347
- d.approximate?(:day).should be false
348
- d.uncertain?(:day).should be false
347
+ expect(d.approximate?(:day)).to be false
348
+ expect(d.uncertain?(:day)).to be false
349
349
 
350
350
  end
351
351