bible_passage 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,178 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe BiblePassage::BookDataStore do
4
+
5
+ let(:store) { BiblePassage::BookDataStore.new }
6
+
7
+ context "book_name" do
8
+
9
+ def self.it_gets_book_name(book_key, book_name)
10
+ it "returns #{book_name} for :#{book_key}" do
11
+ expect(store.book_name(book_key)).to eq(book_name)
12
+ end
13
+ end
14
+
15
+ it_gets_book_name(:gen, 'Genesis')
16
+ it_gets_book_name(:exod, 'Exodus')
17
+ it_gets_book_name(:lev, 'Leviticus')
18
+ it_gets_book_name(:num, 'Numbers')
19
+ it_gets_book_name(:deut, 'Deuteronomy')
20
+ it_gets_book_name(:josh, 'Joshua')
21
+ it_gets_book_name(:judg, 'Judges')
22
+ it_gets_book_name(:ruth, 'Ruth')
23
+ it_gets_book_name('1sam'.to_sym, '1 Samuel')
24
+ it_gets_book_name('2sam'.to_sym, '2 Samuel')
25
+ it_gets_book_name('1kings'.to_sym, '1 Kings')
26
+ it_gets_book_name('2kings'.to_sym, '2 Kings')
27
+ it_gets_book_name('1chr'.to_sym, '1 Chronicles')
28
+ it_gets_book_name('2chr'.to_sym, '2 Chronicles')
29
+ it_gets_book_name(:ezra, 'Ezra')
30
+ it_gets_book_name(:neh, 'Nehemiah')
31
+ it_gets_book_name(:esth, 'Esther')
32
+ it_gets_book_name(:job, 'Job')
33
+ it_gets_book_name(:ps, 'Psalms')
34
+ it_gets_book_name(:prov, 'Proverbs')
35
+ it_gets_book_name(:eccl, 'Ecclesiastes')
36
+ it_gets_book_name(:song, 'Song of Songs')
37
+ it_gets_book_name(:isa, 'Isaiah')
38
+ it_gets_book_name(:jer, 'Jeremiah')
39
+ it_gets_book_name(:lam, 'Lamentations')
40
+ it_gets_book_name(:ezek, 'Ezekiel')
41
+ it_gets_book_name(:dan, 'Daniel')
42
+ it_gets_book_name(:hos, 'Hosea')
43
+ it_gets_book_name(:joel, 'Joel')
44
+ it_gets_book_name(:amos, 'Amos')
45
+ it_gets_book_name(:obad, 'Obadiah')
46
+ it_gets_book_name(:jonah, 'Jonah')
47
+ it_gets_book_name(:mic, 'Micah')
48
+ it_gets_book_name(:nah, 'Nahum')
49
+ it_gets_book_name(:hab, 'Habakkuk')
50
+ it_gets_book_name(:zeph, 'Zephaniah')
51
+ it_gets_book_name(:hag, 'Haggai')
52
+ it_gets_book_name(:zech, 'Zechariah')
53
+ it_gets_book_name(:mal, 'Malachi')
54
+ it_gets_book_name(:matt, 'Matthew')
55
+ it_gets_book_name(:mark, 'Mark')
56
+ it_gets_book_name(:luke, 'Luke')
57
+ it_gets_book_name(:john, 'John')
58
+ it_gets_book_name(:acts, 'Acts')
59
+ it_gets_book_name(:rom, 'Romans')
60
+ it_gets_book_name('1cor'.to_sym, '1 Corinthians')
61
+ it_gets_book_name('2cor'.to_sym, '2 Corinthians')
62
+ it_gets_book_name(:gal, 'Galatians')
63
+ it_gets_book_name(:eph, 'Ephesians')
64
+ it_gets_book_name(:phil, 'Philippians')
65
+ it_gets_book_name(:col, 'Colossians')
66
+ it_gets_book_name('1thess'.to_sym, '1 Thessalonians')
67
+ it_gets_book_name('2thess'.to_sym, '2 Thessalonians')
68
+ it_gets_book_name('1tim'.to_sym, '1 Timothy')
69
+ it_gets_book_name('2tim'.to_sym, '2 Timothy')
70
+ it_gets_book_name(:titus, 'Titus')
71
+ it_gets_book_name(:phlm, 'Philemon')
72
+ it_gets_book_name(:heb, 'Hebrews')
73
+ it_gets_book_name(:jas, 'James')
74
+ it_gets_book_name('1pet'.to_sym, '1 Peter')
75
+ it_gets_book_name('2pet'.to_sym, '2 Peter')
76
+ it_gets_book_name('1john'.to_sym, '1 John')
77
+ it_gets_book_name('2john'.to_sym, '2 John')
78
+ it_gets_book_name('3john'.to_sym, '3 John')
79
+ it_gets_book_name(:jude, 'Jude')
80
+ it_gets_book_name(:rev, 'Revelation')
81
+
82
+ it "errors if key is not found" do
83
+ expect { store.book_name(:ex) }.to raise_error(
84
+ BiblePassage::InvalidReferenceError, "ex is not a valid book key")
85
+ end
86
+
87
+ end
88
+
89
+ context "number_of_chapters" do
90
+
91
+ def self.it_gets_number_of_chapters(book_key, n)
92
+ it "returns #{n} for :#{book_key}" do
93
+ expect(store.number_of_chapters(book_key)).to eq(n)
94
+ end
95
+ end
96
+
97
+ it_gets_number_of_chapters(:gen, 50)
98
+ it_gets_number_of_chapters(:exod, 40)
99
+ it_gets_number_of_chapters(:lev, 27)
100
+ it_gets_number_of_chapters(:num, 36)
101
+ it_gets_number_of_chapters(:deut, 34)
102
+ it_gets_number_of_chapters(:josh, 24)
103
+ it_gets_number_of_chapters(:judg, 21)
104
+ it_gets_number_of_chapters(:ruth, 4)
105
+ it_gets_number_of_chapters('1sam'.to_sym, 31)
106
+ it_gets_number_of_chapters('2sam'.to_sym, 24)
107
+ it_gets_number_of_chapters('1kings'.to_sym, 22)
108
+ it_gets_number_of_chapters('2kings'.to_sym, 25)
109
+ it_gets_number_of_chapters('1chr'.to_sym, 29)
110
+ it_gets_number_of_chapters('2chr'.to_sym, 36)
111
+ it_gets_number_of_chapters(:ezra, 10)
112
+ it_gets_number_of_chapters(:neh, 13)
113
+ it_gets_number_of_chapters(:esth, 10)
114
+ it_gets_number_of_chapters(:job, 42)
115
+ it_gets_number_of_chapters(:ps, 150)
116
+ it_gets_number_of_chapters(:prov, 31)
117
+ it_gets_number_of_chapters(:eccl, 12)
118
+ it_gets_number_of_chapters(:song, 8)
119
+ it_gets_number_of_chapters(:isa, 66)
120
+ it_gets_number_of_chapters(:jer, 52)
121
+ it_gets_number_of_chapters(:lam, 5)
122
+ it_gets_number_of_chapters(:ezek, 48)
123
+ it_gets_number_of_chapters(:dan, 12)
124
+ it_gets_number_of_chapters(:hos, 14)
125
+ it_gets_number_of_chapters(:joel, 3)
126
+ it_gets_number_of_chapters(:amos, 9)
127
+ it_gets_number_of_chapters(:obad, 1)
128
+ it_gets_number_of_chapters(:jonah, 4)
129
+ it_gets_number_of_chapters(:mic, 7)
130
+ it_gets_number_of_chapters(:nah, 3)
131
+ it_gets_number_of_chapters(:hab, 3)
132
+ it_gets_number_of_chapters(:zeph, 3)
133
+ it_gets_number_of_chapters(:hag, 2)
134
+ it_gets_number_of_chapters(:zech, 14)
135
+ it_gets_number_of_chapters(:mal, 4)
136
+ it_gets_number_of_chapters(:matt, 28)
137
+ it_gets_number_of_chapters(:mark, 16)
138
+ it_gets_number_of_chapters(:luke, 24)
139
+ it_gets_number_of_chapters(:john, 21)
140
+ it_gets_number_of_chapters(:acts, 28)
141
+ it_gets_number_of_chapters(:rom, 16)
142
+ it_gets_number_of_chapters('1cor'.to_sym, 16)
143
+ it_gets_number_of_chapters('2cor'.to_sym, 13)
144
+ it_gets_number_of_chapters(:gal, 6)
145
+ it_gets_number_of_chapters(:eph, 6)
146
+ it_gets_number_of_chapters(:phil, 4)
147
+ it_gets_number_of_chapters(:col, 4)
148
+ it_gets_number_of_chapters('1thess'.to_sym, 5)
149
+ it_gets_number_of_chapters('2thess'.to_sym, 3)
150
+ it_gets_number_of_chapters('1tim'.to_sym, 6)
151
+ it_gets_number_of_chapters('2tim'.to_sym, 4)
152
+ it_gets_number_of_chapters(:titus, 3)
153
+ it_gets_number_of_chapters(:phlm, 1)
154
+ it_gets_number_of_chapters(:heb, 13)
155
+ it_gets_number_of_chapters(:jas, 5)
156
+ it_gets_number_of_chapters('1pet'.to_sym, 5)
157
+ it_gets_number_of_chapters('2pet'.to_sym, 3)
158
+ it_gets_number_of_chapters('1john'.to_sym, 5)
159
+ it_gets_number_of_chapters('2john'.to_sym, 1)
160
+ it_gets_number_of_chapters('3john'.to_sym, 1)
161
+ it_gets_number_of_chapters(:jude, 1)
162
+ it_gets_number_of_chapters(:rev, 22)
163
+
164
+ end
165
+
166
+ context "number_of_verses" do
167
+
168
+ it "returns 31 for Genesis 1" do
169
+ expect(store.number_of_verses(:gen, 1)).to eq(31)
170
+ end
171
+
172
+ it "returns 25 for Genesis 2" do
173
+ expect(store.number_of_verses(:gen, 2)).to eq(25)
174
+ end
175
+
176
+ end
177
+
178
+ end
@@ -0,0 +1,355 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe BiblePassage::BookKeyTranslator do
4
+
5
+ let(:translator) {BiblePassage::BookKeyTranslator.new }
6
+
7
+ def self.it_translates_to_key(from, to, desc = nil)
8
+ desc ||= "translates #{from} to #{to}"
9
+ it desc do
10
+ expect(translator.keyify(from)).to eq(to)
11
+ end
12
+ end
13
+
14
+ it_translates_to_key("genesis", :gen)
15
+ it_translates_to_key("ge", :gen)
16
+ it_translates_to_key("genesis", :gen)
17
+ it_translates_to_key("gen", :gen)
18
+ it_translates_to_key("gene", :gen)
19
+ it_translates_to_key("genes", :gen)
20
+ it_translates_to_key("gn", :gen)
21
+
22
+ it_translates_to_key("exodus", :exod)
23
+ it_translates_to_key("exod", :exod)
24
+ it_translates_to_key("exo", :exod)
25
+ it_translates_to_key("ex", :exod)
26
+
27
+ it_translates_to_key("leviticus", :lev)
28
+ it_translates_to_key("levit", :lev)
29
+ it_translates_to_key("lev", :lev)
30
+ it_translates_to_key("le", :lev)
31
+
32
+ it_translates_to_key("numbers", :num)
33
+ it_translates_to_key("numb", :num)
34
+ it_translates_to_key("num", :num)
35
+ it_translates_to_key("nu", :num)
36
+ it_translates_to_key("nm", :num)
37
+
38
+ it_translates_to_key("deuteronomy", :deut)
39
+ it_translates_to_key("deuter", :deut)
40
+ it_translates_to_key("deut", :deut)
41
+ it_translates_to_key("deu", :deut)
42
+ it_translates_to_key("de", :deut)
43
+ it_translates_to_key("dt", :deut)
44
+
45
+ it_translates_to_key("joshua", :josh)
46
+ it_translates_to_key("josh", :josh)
47
+ it_translates_to_key("jos", :josh)
48
+
49
+ it_translates_to_key("judges", :judg)
50
+ it_translates_to_key("judg", :judg)
51
+ it_translates_to_key("jdg", :judg)
52
+ it_translates_to_key("jd", :judg)
53
+
54
+ it_translates_to_key("ruth", :ruth)
55
+
56
+ it_translates_to_key("1 samuel", '1sam'.to_sym)
57
+ it_translates_to_key("1 sam", '1sam'.to_sym)
58
+ it_translates_to_key("1 sa", '1sam'.to_sym)
59
+
60
+ it_translates_to_key("2 samuel", '2sam'.to_sym)
61
+ it_translates_to_key("2 sam", '2sam'.to_sym)
62
+ it_translates_to_key("2 sa", '2sam'.to_sym)
63
+
64
+ it_translates_to_key("1 kings", '1kgs'.to_sym)
65
+ it_translates_to_key("1 king", '1kgs'.to_sym)
66
+ it_translates_to_key("1 ki", '1kgs'.to_sym)
67
+ it_translates_to_key("1 kngs", '1kgs'.to_sym)
68
+ it_translates_to_key("1 kgs", '1kgs'.to_sym)
69
+
70
+ it_translates_to_key("2 kings", '2kgs'.to_sym)
71
+ it_translates_to_key("2 king", '2kgs'.to_sym)
72
+ it_translates_to_key("2 ki", '2kgs'.to_sym)
73
+ it_translates_to_key("2 kngs", '2kgs'.to_sym)
74
+ it_translates_to_key("2 kgs", '2kgs'.to_sym)
75
+
76
+ it_translates_to_key("1 chronicles", '1chr'.to_sym)
77
+ it_translates_to_key("1 chron", '1chr'.to_sym)
78
+ it_translates_to_key("1 chro", '1chr'.to_sym)
79
+ it_translates_to_key("1 chr", '1chr'.to_sym)
80
+ it_translates_to_key("1 ch", '1chr'.to_sym)
81
+
82
+ it_translates_to_key("2 chronicles", '2chr'.to_sym)
83
+ it_translates_to_key("2 chron", '2chr'.to_sym)
84
+ it_translates_to_key("2 chro", '2chr'.to_sym)
85
+ it_translates_to_key("2 chr", '2chr'.to_sym)
86
+ it_translates_to_key("2 ch", '2chr'.to_sym)
87
+
88
+ it_translates_to_key("ezra", :ezra)
89
+ it_translates_to_key("ezr", :ezra)
90
+
91
+ it_translates_to_key("nehemiah", :neh)
92
+ it_translates_to_key("nehem", :neh)
93
+ it_translates_to_key("neh", :neh)
94
+ it_translates_to_key("ne", :neh)
95
+
96
+ it_translates_to_key("esther", :esth)
97
+ it_translates_to_key("esth", :esth)
98
+ it_translates_to_key("est", :esth)
99
+ it_translates_to_key("es", :esth)
100
+
101
+ it_translates_to_key("job", :job)
102
+ it_translates_to_key("jo", :job)
103
+
104
+ it_translates_to_key("psalms", :ps)
105
+ it_translates_to_key("psalm", :ps)
106
+ it_translates_to_key("psal", :ps)
107
+ it_translates_to_key("psa", :ps)
108
+ it_translates_to_key("ps", :ps)
109
+
110
+ it_translates_to_key("proverbs", :prov)
111
+ it_translates_to_key("prov", :prov)
112
+ it_translates_to_key("pro", :prov)
113
+ it_translates_to_key("pr", :prov)
114
+
115
+ it_translates_to_key("ecclesiastes", :eccl)
116
+ it_translates_to_key("eccles", :eccl)
117
+ it_translates_to_key("eccl", :eccl)
118
+ it_translates_to_key("ecc", :eccl)
119
+ it_translates_to_key("ec", :eccl)
120
+
121
+ it_translates_to_key("song of solomon", :song)
122
+ it_translates_to_key("song of songs", :song)
123
+ it_translates_to_key("song of sol", :song)
124
+ it_translates_to_key("ss", :song)
125
+ it_translates_to_key("ssong", :song)
126
+ it_translates_to_key("so", :song)
127
+
128
+ it_translates_to_key("isaiah", :isa)
129
+ it_translates_to_key("isa", :isa)
130
+ it_translates_to_key("is", :isa)
131
+
132
+ it_translates_to_key("jeremiah", :jer)
133
+ it_translates_to_key("jerem", :jer)
134
+ it_translates_to_key("jere", :jer)
135
+ it_translates_to_key("jer", :jer)
136
+ it_translates_to_key("je", :jer)
137
+
138
+ it_translates_to_key("lamentations", :lam)
139
+ it_translates_to_key("lament", :lam)
140
+ it_translates_to_key("lamen", :lam)
141
+ it_translates_to_key("lam", :lam)
142
+ it_translates_to_key("la", :lam)
143
+
144
+ it_translates_to_key("ezekiel", :ezek)
145
+ it_translates_to_key("ezek", :ezek)
146
+ it_translates_to_key("eze", :ezek)
147
+
148
+ it_translates_to_key("daniel", :dan)
149
+ it_translates_to_key("dan", :dan)
150
+ it_translates_to_key("da", :dan)
151
+
152
+ it_translates_to_key("hosea", :hos)
153
+ it_translates_to_key("hos", :hos)
154
+ it_translates_to_key("ho", :hos)
155
+
156
+ it_translates_to_key("joel", :joel)
157
+ it_translates_to_key("joe", :joel)
158
+
159
+ it_translates_to_key("amos", :amos)
160
+ it_translates_to_key("am", :amos)
161
+
162
+ it_translates_to_key("obadiah", :obad)
163
+ it_translates_to_key("obad", :obad)
164
+ it_translates_to_key("oba", :obad)
165
+ it_translates_to_key("ob", :obad)
166
+
167
+ it_translates_to_key("jonah", :jonah)
168
+ it_translates_to_key("jona", :jonah)
169
+ it_translates_to_key("jon", :jonah)
170
+
171
+ it_translates_to_key("micah", :mic)
172
+ it_translates_to_key("mic", :mic)
173
+ it_translates_to_key("mi", :mic)
174
+
175
+ it_translates_to_key("nahum", :nah)
176
+ it_translates_to_key("nah", :nah)
177
+ it_translates_to_key("na", :nah)
178
+
179
+ it_translates_to_key("habakkuk", :hab)
180
+ it_translates_to_key("habak", :hab)
181
+ it_translates_to_key("hab", :hab)
182
+
183
+ it_translates_to_key("zephaniah", :zeph)
184
+ it_translates_to_key("zeph", :zeph)
185
+ it_translates_to_key("zep", :zeph)
186
+
187
+ it_translates_to_key("haggai", :hag)
188
+ it_translates_to_key("hagg", :hag)
189
+ it_translates_to_key("hag", :hag)
190
+
191
+ it_translates_to_key("zechariah", :zech)
192
+ it_translates_to_key("zech", :zech)
193
+ it_translates_to_key("zec", :zech)
194
+
195
+ it_translates_to_key("malachi", :mal)
196
+ it_translates_to_key("malach", :mal)
197
+ it_translates_to_key("malac", :mal)
198
+ it_translates_to_key("mal", :mal)
199
+
200
+ it_translates_to_key("matthew", :matt)
201
+ it_translates_to_key("matth", :matt)
202
+ it_translates_to_key("matt", :matt)
203
+ it_translates_to_key("mat", :matt)
204
+ it_translates_to_key("mt", :matt)
205
+
206
+ it_translates_to_key("mark", :mark)
207
+ it_translates_to_key("mar", :mark)
208
+ it_translates_to_key("mrk", :mark)
209
+ it_translates_to_key("mr", :mark)
210
+
211
+ it_translates_to_key("luke", :luke)
212
+ it_translates_to_key("luk", :luke)
213
+ it_translates_to_key("lu", :luke)
214
+ it_translates_to_key("lke", :luke)
215
+ it_translates_to_key("lk", :luke)
216
+
217
+ it_translates_to_key("john", :john)
218
+ it_translates_to_key("joh", :john)
219
+ it_translates_to_key("jhn", :john)
220
+ it_translates_to_key("jn", :john)
221
+
222
+ it_translates_to_key("acts", :acts)
223
+ it_translates_to_key("act", :acts)
224
+ it_translates_to_key("ac", :acts)
225
+
226
+ it_translates_to_key("romans", :rom)
227
+ it_translates_to_key("roman", :rom)
228
+ it_translates_to_key("rom", :rom)
229
+ it_translates_to_key("ro", :rom)
230
+
231
+ it_translates_to_key("1 corinthians", '1cor'.to_sym)
232
+ it_translates_to_key("1 corinth", '1cor'.to_sym)
233
+ it_translates_to_key("1 corin", '1cor'.to_sym)
234
+ it_translates_to_key("1 cor", '1cor'.to_sym)
235
+ it_translates_to_key("1 co", '1cor'.to_sym)
236
+
237
+ it_translates_to_key("2 corinthians", '2cor'.to_sym)
238
+ it_translates_to_key("2 corinth", '2cor'.to_sym)
239
+ it_translates_to_key("2 corin", '2cor'.to_sym)
240
+ it_translates_to_key("2 cor", '2cor'.to_sym)
241
+ it_translates_to_key("2 co", '2cor'.to_sym)
242
+
243
+ it_translates_to_key("galatians", :gal)
244
+ it_translates_to_key("galat", :gal)
245
+ it_translates_to_key("gal", :gal)
246
+ it_translates_to_key("ga", :gal)
247
+
248
+ it_translates_to_key("ephesians", :eph)
249
+ it_translates_to_key("ephes", :eph)
250
+ it_translates_to_key("eph", :eph)
251
+ it_translates_to_key("ep", :eph)
252
+
253
+ it_translates_to_key("philippians", :phil)
254
+ it_translates_to_key("philipp", :phil)
255
+ it_translates_to_key("philip", :phil)
256
+ it_translates_to_key("phili", :phil)
257
+ it_translates_to_key("phil", :phil)
258
+ it_translates_to_key("phi", :phil)
259
+ it_translates_to_key("php", :phil)
260
+ it_translates_to_key("ph", :phil)
261
+
262
+ it_translates_to_key("colossians", :col)
263
+ it_translates_to_key("coloss", :col)
264
+ it_translates_to_key("colos", :col)
265
+ it_translates_to_key("colo", :col)
266
+ it_translates_to_key("col", :col)
267
+ it_translates_to_key("co", :col)
268
+
269
+ it_translates_to_key("1 thessalonians", '1thess'.to_sym)
270
+ it_translates_to_key("1 thess", '1thess'.to_sym)
271
+ it_translates_to_key("1 thes", '1thess'.to_sym)
272
+ it_translates_to_key("1 the", '1thess'.to_sym)
273
+ it_translates_to_key("1 th", '1thess'.to_sym)
274
+
275
+ it_translates_to_key("2 thessalonians", '2thess'.to_sym)
276
+ it_translates_to_key("2 thess", '2thess'.to_sym)
277
+ it_translates_to_key("2 thes", '2thess'.to_sym)
278
+ it_translates_to_key("2 the", '2thess'.to_sym)
279
+ it_translates_to_key("2 th", '2thess'.to_sym)
280
+
281
+ it_translates_to_key("1 timothy", '1tim'.to_sym)
282
+ it_translates_to_key("1 tim", '1tim'.to_sym)
283
+ it_translates_to_key("1 ti", '1tim'.to_sym)
284
+
285
+ it_translates_to_key("2 timothy", '2tim'.to_sym)
286
+ it_translates_to_key("2 tim", '2tim'.to_sym)
287
+ it_translates_to_key("2 ti", '2tim'.to_sym)
288
+
289
+ it_translates_to_key("titus", :titus)
290
+ it_translates_to_key("titu", :titus)
291
+ it_translates_to_key("tit", :titus)
292
+
293
+ it_translates_to_key("philemon", :phlm)
294
+ it_translates_to_key("philem", :phlm)
295
+ it_translates_to_key("phile", :phlm)
296
+ it_translates_to_key("phlm", :phlm)
297
+ it_translates_to_key("phm", :phlm)
298
+ it_translates_to_key("phlmn", :phlm)
299
+ it_translates_to_key("phmn", :phlm)
300
+
301
+ it_translates_to_key("hebrews", :heb)
302
+ it_translates_to_key("hebr", :heb)
303
+ it_translates_to_key("heb", :heb)
304
+ it_translates_to_key("he", :heb)
305
+
306
+ it_translates_to_key("james", :jas)
307
+ it_translates_to_key("jas", :jas)
308
+ it_translates_to_key("jam", :jas)
309
+
310
+ it_translates_to_key("1 peter", '1pet'.to_sym)
311
+ it_translates_to_key("1 pet", '1pet'.to_sym)
312
+ it_translates_to_key("1 pe", '1pet'.to_sym)
313
+
314
+ it_translates_to_key("2 peter", '2pet'.to_sym)
315
+ it_translates_to_key("2 pet", '2pet'.to_sym)
316
+ it_translates_to_key("2 pe", '2pet'.to_sym)
317
+
318
+ it_translates_to_key("1 john", '1john'.to_sym)
319
+ it_translates_to_key("1 joh", '1john'.to_sym)
320
+ it_translates_to_key("1 jo", '1john'.to_sym)
321
+ it_translates_to_key("1 jn", '1john'.to_sym)
322
+
323
+ it_translates_to_key("2 john", '2john'.to_sym)
324
+ it_translates_to_key("2 joh", '2john'.to_sym)
325
+ it_translates_to_key("2 jo", '2john'.to_sym)
326
+ it_translates_to_key("2 jn", '2john'.to_sym)
327
+
328
+ it_translates_to_key("3 john", '3john'.to_sym)
329
+ it_translates_to_key("3 joh", '3john'.to_sym)
330
+ it_translates_to_key("3 jo", '3john'.to_sym)
331
+ it_translates_to_key("3 jn", '3john'.to_sym)
332
+
333
+ it_translates_to_key("jude", :jude)
334
+
335
+ it_translates_to_key("revelation", :rev)
336
+ it_translates_to_key("revel", :rev)
337
+ it_translates_to_key("rev", :rev)
338
+ it_translates_to_key("re", :rev)
339
+
340
+ it_translates_to_key(" titus ", :titus, "handles surrounding whitespace")
341
+ it_translates_to_key("song of
342
+ solomon", :song, "handles extra spaces")
343
+
344
+ it_translates_to_key("1 Corinthians", '1cor'.to_sym, "handles capitals")
345
+
346
+ it "errors if description is not found" do
347
+ expect { translator.keyify("nonsense") }.to raise_error(
348
+ BiblePassage::InvalidReferenceError, "nonsense is not a valid book")
349
+ end
350
+
351
+ it "errors if spaces are inserted in words" do
352
+ expect { translator.keyify("jo hn") }.to raise_error(
353
+ BiblePassage::InvalidReferenceError, "jo hn is not a valid book")
354
+ end
355
+ end