confidential_info_redactor_lite 0.0.34 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module ConfidentialInfoRedactorLite
2
- VERSION = "0.0.34"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -17,292 +17,292 @@ RSpec.describe ConfidentialInfoRedactorLite::Date do
17
17
  let(:ja_month_abbr) { %w(1月 2月 3月 4月 5月 6月 7月 8月 9月 10月 11月 12月 1月 2月 3月 4月 5月 6月 7月 8月 9月 10月 11月 12月) }
18
18
 
19
19
  context '#includes_date?' do
20
- it 'returns true if the string includes a date #001' do
21
- string = 'Today is Monday, April 4th, 2011, aka 04/04/2011.'
22
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
23
- expect(ws.includes_date?).to eq(true)
20
+ it 'returns true if the text includes a date #001' do
21
+ text = 'Today is Monday, April 4th, 2011, aka 04/04/2011.'
22
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
23
+ expect(ws.includes_date?(text)).to eq(true)
24
24
  end
25
25
 
26
- it 'returns true if the string includes a date #002' do
27
- string = 'Today is Monday April 4th 2011.'
28
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
29
- expect(ws.includes_date?).to eq(true)
26
+ it 'returns true if the text includes a date #002' do
27
+ text = 'Today is Monday April 4th 2011.'
28
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
29
+ expect(ws.includes_date?(text)).to eq(true)
30
30
  end
31
31
 
32
- it 'returns true if the string includes a date #003' do
33
- string = 'Today is April 4th, 2011.'
34
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
35
- expect(ws.includes_date?).to eq(true)
32
+ it 'returns true if the text includes a date #003' do
33
+ text = 'Today is April 4th, 2011.'
34
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
35
+ expect(ws.includes_date?(text)).to eq(true)
36
36
  end
37
37
 
38
- it 'returns true if the string includes a date #004' do
39
- string = 'Today is Mon., Apr. 4, 2011.'
40
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
41
- expect(ws.includes_date?).to eq(true)
38
+ it 'returns true if the text includes a date #004' do
39
+ text = 'Today is Mon., Apr. 4, 2011.'
40
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
41
+ expect(ws.includes_date?(text)).to eq(true)
42
42
  end
43
43
 
44
- it 'returns true if the string includes a date #005' do
45
- string = 'Today is 04/04/2011.'
46
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
47
- expect(ws.includes_date?).to eq(true)
44
+ it 'returns true if the text includes a date #005' do
45
+ text = 'Today is 04/04/2011.'
46
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
47
+ expect(ws.includes_date?(text)).to eq(true)
48
48
  end
49
49
 
50
- it 'returns true if the string includes a date #006' do
51
- string = 'Today is 04.04.2011.'
52
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
53
- expect(ws.includes_date?).to eq(true)
50
+ it 'returns true if the text includes a date #006' do
51
+ text = 'Today is 04.04.2011.'
52
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
53
+ expect(ws.includes_date?(text)).to eq(true)
54
54
  end
55
55
 
56
- it 'returns true if the string includes a date #007' do
57
- string = 'Today is 2011.04.04.'
58
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
59
- expect(ws.includes_date?).to eq(true)
56
+ it 'returns true if the text includes a date #007' do
57
+ text = 'Today is 2011.04.04.'
58
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
59
+ expect(ws.includes_date?(text)).to eq(true)
60
60
  end
61
61
 
62
- it 'returns true if the string includes a date #008' do
63
- string = 'Today is 2011/04/04.'
64
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
65
- expect(ws.includes_date?).to eq(true)
62
+ it 'returns true if the text includes a date #008' do
63
+ text = 'Today is 2011/04/04.'
64
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
65
+ expect(ws.includes_date?(text)).to eq(true)
66
66
  end
67
67
 
68
- it 'returns true if the string includes a date #009' do
69
- string = 'Today is 2011-04-04.'
70
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
71
- expect(ws.includes_date?).to eq(true)
68
+ it 'returns true if the text includes a date #009' do
69
+ text = 'Today is 2011-04-04.'
70
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
71
+ expect(ws.includes_date?(text)).to eq(true)
72
72
  end
73
73
 
74
- it 'returns true if the string includes a date #010' do
75
- string = 'Today is 04-04-2011.'
76
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
77
- expect(ws.includes_date?).to eq(true)
74
+ it 'returns true if the text includes a date #010' do
75
+ text = 'Today is 04-04-2011.'
76
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
77
+ expect(ws.includes_date?(text)).to eq(true)
78
78
  end
79
79
 
80
- it 'returns true if the string includes a date #011' do
81
- string = 'Today is 2003 November 9.'
82
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
83
- expect(ws.includes_date?).to eq(true)
80
+ it 'returns true if the text includes a date #011' do
81
+ text = 'Today is 2003 November 9.'
82
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
83
+ expect(ws.includes_date?(text)).to eq(true)
84
84
  end
85
85
 
86
- it 'returns true if the string includes a date #012' do
87
- string = 'Today is 2003Nov9.'
88
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
89
- expect(ws.includes_date?).to eq(true)
86
+ it 'returns true if the text includes a date #012' do
87
+ text = 'Today is 2003Nov9.'
88
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
89
+ expect(ws.includes_date?(text)).to eq(true)
90
90
  end
91
91
 
92
- it 'returns true if the string includes a date #013' do
93
- string = 'Today is 2003Nov09.'
94
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
95
- expect(ws.includes_date?).to eq(true)
92
+ it 'returns true if the text includes a date #013' do
93
+ text = 'Today is 2003Nov09.'
94
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
95
+ expect(ws.includes_date?(text)).to eq(true)
96
96
  end
97
97
 
98
- it 'returns true if the string includes a date #014' do
99
- string = 'Today is 2003-Nov-9.'
100
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
101
- expect(ws.includes_date?).to eq(true)
98
+ it 'returns true if the text includes a date #014' do
99
+ text = 'Today is 2003-Nov-9.'
100
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
101
+ expect(ws.includes_date?(text)).to eq(true)
102
102
  end
103
103
 
104
- it 'returns true if the string includes a date #015' do
105
- string = 'Today is 2003-Nov-09.'
106
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
107
- expect(ws.includes_date?).to eq(true)
104
+ it 'returns true if the text includes a date #015' do
105
+ text = 'Today is 2003-Nov-09.'
106
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
107
+ expect(ws.includes_date?(text)).to eq(true)
108
108
  end
109
109
 
110
- it 'returns true if the string includes a date #016' do
111
- string = 'Today is 2003-Nov-9, Sunday.'
112
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
113
- expect(ws.includes_date?).to eq(true)
110
+ it 'returns true if the text includes a date #016' do
111
+ text = 'Today is 2003-Nov-9, Sunday.'
112
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
113
+ expect(ws.includes_date?(text)).to eq(true)
114
114
  end
115
115
 
116
- it 'returns true if the string includes a date #017' do
117
- string = 'Today is 2003. november 9.'
118
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
119
- expect(ws.includes_date?).to eq(true)
116
+ it 'returns true if the text includes a date #017' do
117
+ text = 'Today is 2003. november 9.'
118
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
119
+ expect(ws.includes_date?(text)).to eq(true)
120
120
  end
121
121
 
122
- it 'returns true if the string includes a date #018' do
123
- string = 'Today is 2003.11.9.'
124
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
125
- expect(ws.includes_date?).to eq(true)
122
+ it 'returns true if the text includes a date #018' do
123
+ text = 'Today is 2003.11.9.'
124
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
125
+ expect(ws.includes_date?(text)).to eq(true)
126
126
  end
127
127
 
128
- it 'returns true if the string includes a date #019' do
129
- string = 'Today is Monday, Apr. 4, 2011.'
130
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
131
- expect(ws.includes_date?).to eq(true)
128
+ it 'returns true if the text includes a date #019' do
129
+ text = 'Today is Monday, Apr. 4, 2011.'
130
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
131
+ expect(ws.includes_date?(text)).to eq(true)
132
132
  end
133
133
 
134
- it 'returns true if the string includes a date #020' do
135
- string = 'Today is 2003/11/09.'
136
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
137
- expect(ws.includes_date?).to eq(true)
134
+ it 'returns true if the text includes a date #020' do
135
+ text = 'Today is 2003/11/09.'
136
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
137
+ expect(ws.includes_date?(text)).to eq(true)
138
138
  end
139
139
 
140
- it 'returns true if the string includes a date #021' do
141
- string = 'Today is 20030109.'
142
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
143
- expect(ws.includes_date?).to eq(true)
140
+ it 'returns true if the text includes a date #021' do
141
+ text = 'Today is 20030109.'
142
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
143
+ expect(ws.includes_date?(text)).to eq(true)
144
144
  end
145
145
 
146
- it 'returns true if the string includes a date #022' do
147
- string = 'Today is 01092003.'
148
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
149
- expect(ws.includes_date?).to eq(true)
146
+ it 'returns true if the text includes a date #022' do
147
+ text = 'Today is 01092003.'
148
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
149
+ expect(ws.includes_date?(text)).to eq(true)
150
150
  end
151
151
 
152
- it 'returns true if the string includes a date #023' do
153
- string = 'Today is Sunday, November 9, 2014.'
154
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
155
- expect(ws.includes_date?).to eq(true)
152
+ it 'returns true if the text includes a date #023' do
153
+ text = 'Today is Sunday, November 9, 2014.'
154
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
155
+ expect(ws.includes_date?(text)).to eq(true)
156
156
  end
157
157
 
158
- it 'returns true if the string includes a date #024' do
159
- string = 'Today is November 9, 2014.'
160
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
161
- expect(ws.includes_date?).to eq(true)
158
+ it 'returns true if the text includes a date #024' do
159
+ text = 'Today is November 9, 2014.'
160
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
161
+ expect(ws.includes_date?(text)).to eq(true)
162
162
  end
163
163
 
164
- it 'returns true if the string includes a date #025' do
165
- string = 'Today is Nov. 9, 2014.'
166
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
167
- expect(ws.includes_date?).to eq(true)
164
+ it 'returns true if the text includes a date #025' do
165
+ text = 'Today is Nov. 9, 2014.'
166
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
167
+ expect(ws.includes_date?(text)).to eq(true)
168
168
  end
169
169
 
170
- it 'returns true if the string includes a date #026' do
171
- string = 'Today is july 1st.'
172
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
173
- expect(ws.includes_date?).to eq(true)
170
+ it 'returns true if the text includes a date #026' do
171
+ text = 'Today is july 1st.'
172
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
173
+ expect(ws.includes_date?(text)).to eq(true)
174
174
  end
175
175
 
176
- it 'returns true if the string includes a date #027' do
177
- string = 'Today is jul. 1st.'
178
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
179
- expect(ws.includes_date?).to eq(true)
176
+ it 'returns true if the text includes a date #027' do
177
+ text = 'Today is jul. 1st.'
178
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
179
+ expect(ws.includes_date?(text)).to eq(true)
180
180
  end
181
181
 
182
- it 'returns true if the string includes a date #028' do
183
- string = 'Today is 8 November 2014.'
184
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
185
- expect(ws.includes_date?).to eq(true)
182
+ it 'returns true if the text includes a date #028' do
183
+ text = 'Today is 8 November 2014.'
184
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
185
+ expect(ws.includes_date?(text)).to eq(true)
186
186
  end
187
187
 
188
- it 'returns true if the string includes a date #029' do
189
- string = 'Today is 8. November 2014.'
190
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
191
- expect(ws.includes_date?).to eq(true)
188
+ it 'returns true if the text includes a date #029' do
189
+ text = 'Today is 8. November 2014.'
190
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
191
+ expect(ws.includes_date?(text)).to eq(true)
192
192
  end
193
193
 
194
- it 'returns true if the string includes a date #030' do
195
- string = 'Today is 08-Nov-2014.'
196
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
197
- expect(ws.includes_date?).to eq(true)
194
+ it 'returns true if the text includes a date #030' do
195
+ text = 'Today is 08-Nov-2014.'
196
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
197
+ expect(ws.includes_date?(text)).to eq(true)
198
198
  end
199
199
 
200
- it 'returns true if the string includes a date #031' do
201
- string = 'Today is 08Nov14.'
202
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
203
- expect(ws.includes_date?).to eq(true)
200
+ it 'returns true if the text includes a date #031' do
201
+ text = 'Today is 08Nov14.'
202
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
203
+ expect(ws.includes_date?(text)).to eq(true)
204
204
  end
205
205
 
206
- it 'returns true if the string includes a date #032' do
207
- string = 'Today is 8th November 2014.'
208
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
209
- expect(ws.includes_date?).to eq(true)
206
+ it 'returns true if the text includes a date #032' do
207
+ text = 'Today is 8th November 2014.'
208
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
209
+ expect(ws.includes_date?(text)).to eq(true)
210
210
  end
211
211
 
212
- it 'returns true if the string includes a date #033' do
213
- string = 'Today is the 8th of November 2014.'
214
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
215
- expect(ws.includes_date?).to eq(true)
212
+ it 'returns true if the text includes a date #033' do
213
+ text = 'Today is the 8th of November 2014.'
214
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
215
+ expect(ws.includes_date?(text)).to eq(true)
216
216
  end
217
217
 
218
- it 'returns true if the string includes a date #034' do
219
- string = 'Today is 08/Nov/2014.'
220
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
221
- expect(ws.includes_date?).to eq(true)
218
+ it 'returns true if the text includes a date #034' do
219
+ text = 'Today is 08/Nov/2014.'
220
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
221
+ expect(ws.includes_date?(text)).to eq(true)
222
222
  end
223
223
 
224
- it 'returns true if the string includes a date #035' do
225
- string = 'Today is Sunday, 8 November 2014.'
226
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
227
- expect(ws.includes_date?).to eq(true)
224
+ it 'returns true if the text includes a date #035' do
225
+ text = 'Today is Sunday, 8 November 2014.'
226
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
227
+ expect(ws.includes_date?(text)).to eq(true)
228
228
  end
229
229
 
230
- it 'returns true if the string includes a date #036' do
231
- string = 'Today is 8 November 2014.'
232
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
233
- expect(ws.includes_date?).to eq(true)
230
+ it 'returns true if the text includes a date #036' do
231
+ text = 'Today is 8 November 2014.'
232
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
233
+ expect(ws.includes_date?(text)).to eq(true)
234
234
  end
235
235
 
236
- it 'returns false if the string does not include a date #037' do
237
- string = 'Hello world. There is no date here - $50,000. The sun is hot.'
238
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
239
- expect(ws.includes_date?).to eq(false)
236
+ it 'returns false if the text does not include a date #037' do
237
+ text = 'Hello world. There is no date here - $50,000. The sun is hot.'
238
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
239
+ expect(ws.includes_date?(text)).to eq(false)
240
240
  end
241
241
  end
242
242
 
243
243
  context '#occurences' do
244
- it 'counts the date occurences in a string #001' do
245
- string = 'Today is Sunday, 8 November 2014.'
246
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
247
- expect(ws.occurences).to eq(1)
244
+ it 'counts the date occurences in a text #001' do
245
+ text = 'Today is Sunday, 8 November 2014.'
246
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
247
+ expect(ws.occurences(text)).to eq(1)
248
248
  end
249
249
 
250
- it 'counts the date occurences in a string #002' do
251
- string = 'Today is Sunday, 8 November 2014. Yesterday was 07/Nov/2014.'
252
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
253
- expect(ws.occurences).to eq(2)
250
+ it 'counts the date occurences in a text #002' do
251
+ text = 'Today is Sunday, 8 November 2014. Yesterday was 07/Nov/2014.'
252
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
253
+ expect(ws.occurences(text)).to eq(2)
254
254
  end
255
255
  end
256
256
 
257
257
  context '#replace' do
258
258
  context 'English (en)' do
259
- it 'replaces the date occurences in a string #001' do
260
- string = 'Today is Tues. March 3rd, 2011.'
261
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
262
- expect(ws.replace).to eq('Today is <redacted date> .')
259
+ it 'replaces the date occurences in a text #001' do
260
+ text = 'Today is Tues. March 3rd, 2011.'
261
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
262
+ expect(ws.replace(text)).to eq('Today is <redacted date> .')
263
263
  end
264
264
 
265
- it 'replaces the date occurences in a string #002' do
266
- string = 'The scavenger hunt ends on Dec. 31st, 2011.'
267
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
268
- expect(ws.replace).to eq('The scavenger hunt ends on <redacted date> .')
265
+ it 'replaces the date occurences in a text #002' do
266
+ text = 'The scavenger hunt ends on Dec. 31st, 2011.'
267
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
268
+ expect(ws.replace(text)).to eq('The scavenger hunt ends on <redacted date> .')
269
269
  end
270
270
  end
271
271
 
272
272
  context 'German (de)' do
273
- it 'replaces the date occurences in a string #001' do
274
- string = '15. Oktober 2015'
275
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: de_dow, dow_abbr: de_dow_abbr, months: de_months, months_abbr: de_month_abbr)
276
- expect(ws.replace).to eq(' <redacted date> ')
273
+ it 'replaces the date occurences in a text #001' do
274
+ text = '15. Oktober 2015'
275
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: de_dow, dow_abbr: de_dow_abbr, months: de_months, months_abbr: de_month_abbr)
276
+ expect(ws.replace(text)).to eq(' <redacted date> ')
277
277
  end
278
278
 
279
- it 'replaces the date occurences in a string #002' do
280
- string = 'Oktober de 15'
281
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: de_dow, dow_abbr: de_dow_abbr, months: de_months, months_abbr: de_month_abbr)
282
- expect(ws.replace).to eq(' <redacted date> ')
279
+ it 'replaces the date occurences in a text #002' do
280
+ text = 'Oktober de 15'
281
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: de_dow, dow_abbr: de_dow_abbr, months: de_months, months_abbr: de_month_abbr)
282
+ expect(ws.replace(text)).to eq(' <redacted date> ')
283
283
  end
284
284
 
285
- it 'replaces the date occurences in a string #003' do
286
- string = '15 de Oktober 2020'
287
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: de_dow, dow_abbr: de_dow_abbr, months: de_months, months_abbr: de_month_abbr)
288
- expect(ws.replace).to eq(' <redacted date> ')
285
+ it 'replaces the date occurences in a text #003' do
286
+ text = '15 de Oktober 2020'
287
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: de_dow, dow_abbr: de_dow_abbr, months: de_months, months_abbr: de_month_abbr)
288
+ expect(ws.replace(text)).to eq(' <redacted date> ')
289
289
  end
290
290
  end
291
291
 
292
292
  context 'Japanese (ja)' do
293
- it 'replaces the date occurences in a string #001' do
294
- string = '2011年12月31日です。'
295
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: ja_dow, dow_abbr: ja_dow_abbr, months: ja_months, months_abbr: ja_month_abbr)
296
- expect(ws.replace).to eq('<redacted date>です。')
293
+ it 'replaces the date occurences in a text #001' do
294
+ text = '2011年12月31日です。'
295
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: ja_dow, dow_abbr: ja_dow_abbr, months: ja_months, months_abbr: ja_month_abbr)
296
+ expect(ws.replace(text)).to eq('<redacted date>です。')
297
297
  end
298
298
  end
299
299
  end
300
300
 
301
301
  context '#replace_number_only_date' do
302
- it 'replaces only the number date occurences in a string' do
303
- string = 'Today is Tues. March 3rd, 2011. 4/28/2013'
304
- ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
305
- expect(ws.replace_number_only_date).to eq("Today is Tues. March 3rd, 2011. <redacted date> ")
302
+ it 'replaces only the number date occurences in a text' do
303
+ text = 'Today is Tues. March 3rd, 2011. 4/28/2013'
304
+ ws = ConfidentialInfoRedactorLite::Date.new(dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr)
305
+ expect(ws.replace_number_only_date(text)).to eq("Today is Tues. March 3rd, 2011. <redacted date> ")
306
306
  end
307
307
  end
308
308
  end