bible_bot 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ module BibleBot
2
+ VERSION = "2.0.0"
3
+ end
@@ -0,0 +1,57 @@
1
+ require 'spec_helper'
2
+
3
+ describe BibleBot::Book do
4
+
5
+ describe "find_by_id" do
6
+ [
7
+ {id: 1, expected: "Genesis"},
8
+ {id: 19, expected: "Psalms"},
9
+ {id: 66, expected: "Revelation"},
10
+ {id: 67, expected: nil},
11
+ ].each do |t|
12
+ context "id=#{t[:id]}" do
13
+ it "It finds #{t[:expected]}" do
14
+ book = described_class.find_by_id(t[:id])
15
+
16
+ if t[:expected] == nil
17
+ expect(book).to be nil
18
+ else
19
+ expect(book).to be_a BibleBot::Book
20
+ expect(book.name).to eq t[:expected]
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ describe "find_by_name" do
28
+ [
29
+ {name: "genesis", expected: "Genesis"},
30
+ {name: "psalm", expected: "Psalms"},
31
+ {name: "rev", expected: "Revelation"},
32
+ {name: "nothing", expected: nil},
33
+ ].each do |t|
34
+ context "name=#{t[:name]}" do
35
+ it "It finds #{t[:expected]}" do
36
+ book = described_class.find_by_name(t[:name])
37
+
38
+ if t[:expected] == nil
39
+ expect(book).to be nil
40
+ else
41
+ expect(book).to be_a BibleBot::Book
42
+ expect(book.name).to eq t[:expected]
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+
50
+ describe "reference" do
51
+ let(:book) { BibleBot::Book.find_by_name("1 John") }
52
+
53
+ it "returns reference" do
54
+ expect(book.reference.inspect).to include(start_verse: "1 John 1:1", end_verse: "1 John 5:21")
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,181 @@
1
+ require 'spec_helper'
2
+
3
+ describe BibleBot::ReferenceMatch do
4
+ describe "scan" do
5
+ test_cases = [
6
+ {ref: "Matthew 1:1 - Mark 4:2", expected: ["Matthew 1:1-Mark 4:2"]},
7
+ {ref: "Matthew 2 - Mark 4", expected: ["Matthew 2-Mark 4"]},
8
+ {ref: "John 1:1", expected: ["John 1:1"]},
9
+ {ref: "John 1:1 is the first first but Romans 8:9-10 is another.", expected: ["John 1:1", "Romans 8:9-10"]},
10
+ {ref: "When Fiery Trials Come Genesis 35:16-29 Part 1", expected: ["Genesis 35:16-29"]},
11
+ {ref: "No book to see here 4:5", expected: []},
12
+ {ref: "Rom 1:6", expected: ["Romans 1:6"]},
13
+ {ref: "Romans 1:6", expected: ["Romans 1:6"]},
14
+ {ref: "Rm 1:8", expected: ["Romans 1:8"]},
15
+ {ref: "Ge 1:1", expected: ["Genesis 1:1"]},
16
+ {ref: "Gen 1:1", expected: ["Genesis 1:1"]},
17
+ {ref: "Genesis", expected: []},
18
+ {ref: "Genesis 5", expected: ["Genesis 5"]},
19
+ {ref: "Genesis 5-10", expected: ["Genesis 5-10"]},
20
+ {ref: "Genesis 1:1 - Exod 4", expected: ["Genesis 1-Exodus 4"]},
21
+ {ref: "Genesis 3 - Genesis 4:3", expected: ["Genesis 3:1-4:3"]},
22
+ {ref: "Ex", expected: []},
23
+ {ref: "Genesis 1:1", expected: ["Genesis 1:1"]},
24
+ {ref: "Ge 1:1", expected: ["Genesis 1:1"]},
25
+ {ref: "Gen 1:1", expected: ["Genesis 1:1"]},
26
+ {ref: "Exodus 1:1", expected: ["Exodus 1:1"]},
27
+ {ref: "Ex 1:1", expected: ["Exodus 1:1"]},
28
+ {ref: "Exod 1:1", expected: ["Exodus 1:1"]},
29
+ {ref: "Leviticus 1:1", expected: ["Leviticus 1:1"]},
30
+ {ref: "Lev 1:1", expected: ["Leviticus 1:1"]},
31
+ {ref: "Numbers 1:1", expected: ["Numbers 1:1"]},
32
+ {ref: "Num 1:1", expected: ["Numbers 1:1"]},
33
+ {ref: "Deuteronomy 1:1", expected: ["Deuteronomy 1:1"]},
34
+ {ref: "Deut 1:1", expected: ["Deuteronomy 1:1"]},
35
+ {ref: "Joshua 1:1", expected: ["Joshua 1:1"]},
36
+ {ref: "Josh 1:1", expected: ["Joshua 1:1"]},
37
+ {ref: "Judges 1:1", expected: ["Judges 1:1"]},
38
+ {ref: "Judg 1:1", expected: ["Judges 1:1"]},
39
+ {ref: "Ruth 1:1", expected: ["Ruth 1:1"]},
40
+ {ref: "1 Samuel 1:1", expected: ["1 Samuel 1:1"]},
41
+ {ref: "1 Sam 1:1", expected: ["1 Samuel 1:1"]},
42
+ {ref: "2 Samuel 1:1", expected: ["2 Samuel 1:1"]},
43
+ {ref: "2 Sam 1:1", expected: ["2 Samuel 1:1"]},
44
+ {ref: "1 Kings 1:1", expected: ["1 Kings 1:1"]},
45
+ {ref: "1 Kgs 1:1", expected: ["1 Kings 1:1"]},
46
+ {ref: "2 Kings 1:1", expected: ["2 Kings 1:1"]},
47
+ {ref: "2 Kgs 1:1", expected: ["2 Kings 1:1"]},
48
+ {ref: "1 Chronicles 1:1", expected: ["1 Chronicles 1:1"]},
49
+ {ref: "1 Chron 1:1", expected: ["1 Chronicles 1:1"]},
50
+ {ref: "2 Chronicles 1:1", expected: ["2 Chronicles 1:1"]},
51
+ {ref: "2 Chron 1:1", expected: ["2 Chronicles 1:1"]},
52
+ {ref: "Ezra 1:1", expected: ["Ezra 1:1"]},
53
+ {ref: "Nehemiah 1:1", expected: ["Nehemiah 1:1"]},
54
+ {ref: "Neh 1:1", expected: ["Nehemiah 1:1"]},
55
+ {ref: "Esther 1:1", expected: ["Esther 1:1"]},
56
+ {ref: "Esth 1:1", expected: ["Esther 1:1"]},
57
+ {ref: "Job 1:1", expected: ["Job 1:1"]},
58
+ {ref: "Psalms 1:1", expected: ["Psalm 1:1"]},
59
+ {ref: "Psalm 1:1", expected: ["Psalm 1:1"]},
60
+ {ref: "Psa 1:1", expected: ["Psalm 1:1"]},
61
+ {ref: "Ps 1:1", expected: ["Psalm 1:1"]},
62
+ {ref: "Proverbs 1:1", expected: ["Proverbs 1:1"]},
63
+ {ref: "Prov 1:1", expected: ["Proverbs 1:1"]},
64
+ {ref: "Ecclesiastes 1:1", expected: ["Ecclesiastes 1:1"]},
65
+ {ref: "Ecc 1:1", expected: ["Ecclesiastes 1:1"]},
66
+ {ref: "Song of Solomon 1:1", expected: ["Song of Solomon 1:1"]},
67
+ {ref: "Song of Songs 1:1", expected: ["Song of Solomon 1:1"]},
68
+ {ref: "Song 1:1", expected: ["Song of Solomon 1:1"]},
69
+ {ref: "Isaiah 1:1", expected: ["Isaiah 1:1"]},
70
+ {ref: "Isa 1:1", expected: ["Isaiah 1:1"]},
71
+ {ref: "Jeremiah 1:1", expected: ["Jeremiah 1:1"]},
72
+ {ref: "Jer 1:1", expected: ["Jeremiah 1:1"]},
73
+ {ref: "Lamentations 1:1", expected: ["Lamentations 1:1"]},
74
+ {ref: "Lam 1:1", expected: ["Lamentations 1:1"]},
75
+ {ref: "Ezekiel 1:1", expected: ["Ezekiel 1:1"]},
76
+ {ref: "Ezek 1:1", expected: ["Ezekiel 1:1"]},
77
+ {ref: "Daniel 1:1", expected: ["Daniel 1:1"]},
78
+ {ref: "Dan 1:1", expected: ["Daniel 1:1"]},
79
+ {ref: "Hosea 1:1", expected: ["Hosea 1:1"]},
80
+ {ref: "Hos 1:1", expected: ["Hosea 1:1"]},
81
+ {ref: "Joel 1:1", expected: ["Joel 1:1"]},
82
+ {ref: "Amos 1:1", expected: ["Amos 1:1"]},
83
+ {ref: "Obadiah 1:1", expected: ["Obadiah 1"]},
84
+ {ref: "Obad 1:1", expected: ["Obadiah 1"]},
85
+ {ref: "Jonah 1:1", expected: ["Jonah 1:1"]},
86
+ {ref: "Micah 1:1", expected: ["Micah 1:1"]},
87
+ {ref: "Mic 1:1", expected: ["Micah 1:1"]},
88
+ {ref: "Nahum 1:1", expected: ["Nahum 1:1"]},
89
+ {ref: "Nah 1:1", expected: ["Nahum 1:1"]},
90
+ {ref: "Habakkuk 1:1", expected: ["Habakkuk 1:1"]},
91
+ {ref: "Hab 1:1", expected: ["Habakkuk 1:1"]},
92
+ {ref: "Zephaniah 1:1", expected: ["Zephaniah 1:1"]},
93
+ {ref: "Zeph 1:1", expected: ["Zephaniah 1:1"]},
94
+ {ref: "Haggai 1:1", expected: ["Haggai 1:1"]},
95
+ {ref: "Hag 1:1", expected: ["Haggai 1:1"]},
96
+ {ref: "Zechariah 1:1", expected: ["Zechariah 1:1"]},
97
+ {ref: "Zech 1:1", expected: ["Zechariah 1:1"]},
98
+ {ref: "Malachi 1:1", expected: ["Malachi 1:1"]},
99
+ {ref: "Mal 1:1", expected: ["Malachi 1:1"]},
100
+ {ref: "Matthew 1:1", expected: ["Matthew 1:1"]},
101
+ {ref: "Matt 1:1", expected: ["Matthew 1:1"]},
102
+ {ref: "Mt 1:1", expected: ["Matthew 1:1"]},
103
+ {ref: "Mark 1:1", expected: ["Mark 1:1"]},
104
+ {ref: "Mk 1:1", expected: ["Mark 1:1"]},
105
+ {ref: "Luke 1:1", expected: ["Luke 1:1"]},
106
+ {ref: "Lk 1:1", expected: ["Luke 1:1"]},
107
+ {ref: "John 1:1", expected: ["John 1:1"]},
108
+ {ref: "Jn 1:1", expected: ["John 1:1"]},
109
+ {ref: "Acts 1:1", expected: ["Acts 1:1"]},
110
+ {ref: "Romans 1:1", expected: ["Romans 1:1"]},
111
+ {ref: "Rom 1:1", expected: ["Romans 1:1"]},
112
+ {ref: "1 Corinthians 1:1", expected: ["1 Corinthians 1:1"]},
113
+ {ref: "1 Cor 1:1", expected: ["1 Corinthians 1:1"]},
114
+ {ref: "2 Corinthians 1:1", expected: ["2 Corinthians 1:1"]},
115
+ {ref: "2 Cor 1:1", expected: ["2 Corinthians 1:1"]},
116
+ {ref: "Galatians 1:1", expected: ["Galatians 1:1"]},
117
+ {ref: "Gal 1:1", expected: ["Galatians 1:1"]},
118
+ {ref: "Ephesians 1:1", expected: ["Ephesians 1:1"]},
119
+ {ref: "Eph 1:1", expected: ["Ephesians 1:1"]},
120
+ {ref: "Philippians 1:1", expected: ["Philippians 1:1"]},
121
+ {ref: "Phil 1:1", expected: ["Philippians 1:1"]},
122
+ {ref: "Colossians 1:1", expected: ["Colossians 1:1"]},
123
+ {ref: "Col 1:1", expected: ["Colossians 1:1"]},
124
+ {ref: "1 Thessalonians 1:1", expected: ["1 Thessalonians 1:1"]},
125
+ {ref: "1 Thess 1:1", expected: ["1 Thessalonians 1:1"]},
126
+ {ref: "2 Thessalonians 1:1", expected: ["2 Thessalonians 1:1"]},
127
+ {ref: "2 Thess 1:1", expected: ["2 Thessalonians 1:1"]},
128
+ {ref: "1 Timothy 1:1", expected: ["1 Timothy 1:1"]},
129
+ {ref: "1 Tim 1:1", expected: ["1 Timothy 1:1"]},
130
+ {ref: "2 Timothy 1:1", expected: ["2 Timothy 1:1"]},
131
+ {ref: "2 Tim 1:1", expected: ["2 Timothy 1:1"]},
132
+ {ref: "Titus 1:1", expected: ["Titus 1:1"]},
133
+ {ref: "Tit 1:1", expected: ["Titus 1:1"]},
134
+ {ref: "Philemon 1:1", expected: ["Philemon 1"]},
135
+ {ref: "Philem 1:1", expected: ["Philemon 1"]},
136
+ {ref: "Hebrews 1:1", expected: ["Hebrews 1:1"]},
137
+ {ref: "Heb 1:1", expected: ["Hebrews 1:1"]},
138
+ {ref: "James 1:1", expected: ["James 1:1"]},
139
+ {ref: "Jas 1:1", expected: ["James 1:1"]},
140
+ {ref: "1 Peter 1:1", expected: ["1 Peter 1:1"]},
141
+ {ref: "1 Pet 1:1", expected: ["1 Peter 1:1"]},
142
+ {ref: "2 Peter 1:1", expected: ["2 Peter 1:1"]},
143
+ {ref: "2 Pet 1:1", expected: ["2 Peter 1:1"]},
144
+ {ref: "1 John 1:1", expected: ["1 John 1:1"]},
145
+ {ref: "I John 1:1", expected: ["1 John 1:1"]},
146
+ {ref: "1 Jn 1:1", expected: ["1 John 1:1"]},
147
+ {ref: "2 John 1:1", expected: ["2 John 1"]},
148
+ {ref: "II John 1:1", expected: ["2 John 1"]},
149
+ {ref: "2 Jn 1:1", expected: ["2 John 1"]},
150
+ {ref: "3 John 1:1", expected: ["3 John 1"]},
151
+ {ref: "III John 1:1", expected: ["3 John 1"]},
152
+ {ref: "3 Jn 1:1", expected: ["3 John 1"]},
153
+ {ref: "Jude 1:1", expected: ["Jude 1"]},
154
+ {ref: "Jude 5", expected: ["Jude 5"]},
155
+ {ref: "Revelation 1:1", expected: ["Revelation 1:1"]},
156
+ {ref: "Rev 1:1", expected: ["Revelation 1:1"]},
157
+ ]
158
+
159
+ test_cases.each do |t|
160
+ it "Can parse \"#{t[:ref]}\"" do
161
+ expect( ReferenceMatch.scan( t[:ref] ).map {|rm| rm.reference.formatted }).to eq t[:expected]
162
+ end
163
+
164
+ it "Can parse \"giberish 84 #{t[:ref]} foo bar\"" do
165
+ expect( ReferenceMatch.scan( "giberish 84 #{t[:ref]} foo bar" ).map {|rm| rm.reference.formatted }).to eq t[:expected]
166
+ end
167
+ end
168
+ end
169
+
170
+ describe "length and offset" do
171
+ let(:text) { "John 1:1 is the first first but Romans 8:9-10 is another." }
172
+ let(:matches) { ReferenceMatch.scan(text) }
173
+
174
+ it "stores the correct length and offset for each match" do
175
+ expect(matches[0].offset).to eq 0
176
+ expect(matches[0].length).to eq 8
177
+ expect(matches[1].offset).to eq 32
178
+ expect(matches[1].length).to eq 13
179
+ end
180
+ end
181
+ end
@@ -0,0 +1,136 @@
1
+ require 'spec_helper'
2
+
3
+ describe BibleBot::Reference do
4
+ describe "parse" do
5
+ [
6
+ ["Genesis 1:1", true, nil],
7
+ ["Genesis 51:4", false, InvalidVerseError],
8
+ ["Romans 5:2-4:11", false, InvalidReferenceError],
9
+ ].each do |ref, expected_valid, expected_error|
10
+ context "parsing \"#{ref}\"" do
11
+ let(:references) { Reference.parse(ref) }
12
+
13
+ it "skips invalid references" do
14
+ expect(references.count).to eq(expected_valid ? 1 : 0)
15
+ end
16
+
17
+ context "validate=false" do
18
+ let(:references) { Reference.parse(ref, validate: false) }
19
+
20
+ it "#{expected_valid ? 'is' : 'is not'} valid" do
21
+ expect(references.all?(&:valid?)).to be expected_valid
22
+ end
23
+
24
+ it "calls formatted without errors" do
25
+ expect(references.first.formatted).to be_a String
26
+ end
27
+ end
28
+
29
+ context "validate=:raise_errors" do
30
+ let(:references) { Reference.parse(ref, validate: :raise_errors) }
31
+
32
+ if expected_valid
33
+ it "includes valid references" do
34
+ expect(references.all?(&:valid?)).to be true
35
+ end
36
+ else
37
+ it "raises error" do
38
+ expect{ references }.to raise_error(expected_error)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ describe "formatted" do
47
+ [
48
+ [1_001_001, nil, "Genesis 1:1"],
49
+ [1_001_001, 1_001_001, "Genesis 1:1"],
50
+ [1_001_001, 1_001_030, "Genesis 1:1-30"],
51
+ [1_001_001, 1_001_031, "Genesis 1"], # Leaves out verses when range includes the entire chapter
52
+ [1_001_001, 1_002_004, "Genesis 1:1-2:4"],
53
+ [1_001_001, 1_002_025, "Genesis 1-2"],
54
+ [1_002_003, 1_003_003, "Genesis 2:3-3:3"],
55
+ [65_001_001, 65_001_006, "Jude 1-6"],
56
+ [65_001_001, 65_001_025, "Jude"],
57
+ [65_001_001, 66_001_015, "Jude 1-Revelation 1:15"],
58
+ [1_050_001, 2_002_013, "Genesis 50:1-Exodus 2:13"],
59
+ [1_001_001, 2_001_001, "Genesis 1:1-Exodus 1:1"],
60
+ ].each do |start_verse_id, end_verse_id, expected_formated_value|
61
+ describe "start_verse_id=#{start_verse_id} and end_verse_id=#{end_verse_id}" do
62
+ subject { described_class.from_verse_ids(start_verse_id, end_verse_id).formatted }
63
+ it { is_expected.to eq expected_formated_value }
64
+ end
65
+ end
66
+ end
67
+
68
+ describe "verses" do
69
+ [
70
+ [1_001_001, nil, 1],
71
+ [1_001_001, 1_001_005, 5],
72
+ [1_001_001, 1_002_005, 36],
73
+ [1_001_001, 2_001_001, 1534],
74
+ ].each do |start_verse_id, end_verse_id, expected_verse_count|
75
+ describe "start_verse_id=#{start_verse_id} and end_verse_id=#{end_verse_id}" do
76
+ subject { described_class.from_verse_ids(start_verse_id, end_verse_id).verses.count }
77
+ it { is_expected.to eq expected_verse_count }
78
+ end
79
+ end
80
+ end
81
+
82
+ describe "include_verses?" do
83
+ [
84
+ [1_001_010, 2_001_001, 1_001_002, false],
85
+ [1_001_010, 2_001_001, 1_001_010, true],
86
+ [1_001_010, 2_001_001, 1_034_005, true],
87
+ [1_001_010, 2_001_001, 2_001_001, true],
88
+ [1_001_010, 2_001_001, 2_001_002, false],
89
+ [1_001_010, 2_001_001, nil, false],
90
+ ].each do |start_verse_id, end_verse_id, included_verse_id, expect_incuded|
91
+ describe "start_verse_id=#{start_verse_id}, end_verse_id=#{end_verse_id}, included_verse_id=#{included_verse_id}" do
92
+ let(:reference) { described_class.from_verse_ids(start_verse_id, end_verse_id) }
93
+ subject { reference.includes_verse?(Verse.from_id(included_verse_id)) }
94
+ it { is_expected.to eq expect_incuded }
95
+ end
96
+ end
97
+ end
98
+
99
+ describe "intersects_reference?" do
100
+ [
101
+ [1_001_010, nil, 1_001_010, nil, true],
102
+ [1_001_010, 1_002_010, 1_002_011, 1_003_001, false],
103
+ [1_001_010, 1_002_010, 1_002_010, 1_003_001, true],
104
+ [1_001_010, 1_002_010, 1_002_009, 1_003_001, true],
105
+ [1_001_010, 1_002_010, 1_001_001, 1_003_001, true],
106
+ [1_001_010, 1_002_010, 1_001_001, 1_001_011, true],
107
+ [1_001_010, 1_002_010, 1_001_001, 1_001_010, true],
108
+ [1_001_010, 1_002_010, 1_001_001, 1_001_009, false],
109
+ ].each do |ref1_start, ref1_end, ref2_start, ref2_end, intersect_expected|
110
+ describe "ref1_start=#{ref1_start}, ref1_end=#{ref1_end}, ref2_start=#{ref2_start}, ref2_end=#{ref2_end}" do
111
+ let(:reference1) { described_class.from_verse_ids(ref1_start, ref1_end) }
112
+ let(:reference2) { described_class.from_verse_ids(ref2_start, ref2_end) }
113
+ subject { reference1.intersects_reference? reference2 }
114
+ it { is_expected.to eq intersect_expected }
115
+ end
116
+ end
117
+ end
118
+
119
+ describe "self.from_verse_ids" do
120
+ context "using Integer verse IDs" do
121
+ let(:reference) { Reference.from_verse_ids(1_001_001, 1_005_002) }
122
+
123
+ it "Successfully initializes Reference" do
124
+ expect(reference.formatted).to eq("Genesis 1:1-5:2")
125
+ end
126
+ end
127
+
128
+ context "using deprecated String verse IDs" do
129
+ let(:reference) { Reference.from_verse_ids("genesis-001-001", "genesis-005-002") }
130
+
131
+ it "Successfully initializes Reference" do
132
+ expect(reference.formatted).to eq("Genesis 1:1-5:2")
133
+ end
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,76 @@
1
+ require 'spec_helper'
2
+
3
+ describe Verse do
4
+ describe 'self.from_id' do
5
+ [
6
+ [19_105_001, "Psalm 105:1"],
7
+ [1_001_001, "Genesis 1:1"],
8
+ [66_022_021, "Revelation 22:21"],
9
+ ].each do |id, expected_reference|
10
+ context "id=integer" do
11
+ it "initializes verse #{expected_reference}" do
12
+ expect(Verse.from_id(id).formatted).to eq(expected_reference)
13
+ end
14
+ end
15
+ end
16
+
17
+ [
18
+ ["psalms-105-001", "Psalm 105:1"],
19
+ ["genesis-001-001", "Genesis 1:1"],
20
+ ["revelation-022-021", "Revelation 22:21"],
21
+ ].each do |id, expected_reference|
22
+ context "id=string" do
23
+ it "initializes verse #{expected_reference}" do
24
+ expect(Verse.from_id(id).formatted).to eq(expected_reference)
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ describe "id" do
31
+ let(:id) { 10_020_004 }
32
+ it "returns back the verse ID" do
33
+ expect(Verse.from_id(id).id).to eq(id)
34
+ end
35
+ end
36
+
37
+ describe "string_id" do
38
+ let(:id) { 10_020_004 }
39
+ let(:string_id) { "2_samuel-020-004" }
40
+ it "returns back the verse ID" do
41
+ expect(Verse.from_id(id).string_id).to eq(string_id)
42
+ end
43
+ end
44
+
45
+ describe "next_verse" do
46
+ context "starting at Genesis 1:1" do
47
+ let(:starting_verse) { Verse.from_id(1_001_001) }
48
+
49
+ it "works through every verse in the bible" do
50
+ count = 0
51
+ verse = starting_verse
52
+ while verse do
53
+ verse = verse.next_verse
54
+ count += 1
55
+ end
56
+
57
+ expect(count).to eq(31_103)
58
+ end
59
+ end
60
+ end
61
+
62
+ describe 'valid?' do
63
+ [
64
+ { verse_id: 1_050_001, expect_valid: true },
65
+ { verse_id: 5_001_046, expect_valid: true },
66
+ { verse_id: 1_051_001, expect_valid: false },
67
+ { verse_id: 5_001_047, expect_valid: false },
68
+ ].each do |t|
69
+ context "verse_id=#{t[:verse_id]}" do
70
+ it "#{t[:expect_valid] ? 'is' : 'is not'} valid" do
71
+ expect(Verse.from_id(t[:verse_id]).valid?).to be t[:expect_valid]
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end