Skip to content

Commit

Permalink
Merge pull request seven1m#10 from BKStephens/fix_judges1_returning_c…
Browse files Browse the repository at this point in the history
…hapter1_verse1

Fix judges1 returning chapter1 verse1
  • Loading branch information
seven1m authored Oct 30, 2020
2 parents 77ce78f + f3c672e commit 3f87075
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bible_ref/languages/english.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class English < Base

# Is it a single chapter book?
def has_single_chapter?(reference)
matches = [/^ob/, /^(jude|jd(?!th)|jud(?!ith))/, /^2 ?jo?h?n/, /^3 ?jo?h?n/, /^ph(i?l|m)/]
matches = [/^ob/, /^(jude|jd(?!th)|jud(?!ith)(?!ges))/, /^2 ?jo?h?n/, /^3 ?jo?h?n/, /^ph(i?l|m)/]
return Regexp.union(matches).match?(reference.downcase)
end

Expand Down
16 changes: 16 additions & 0 deletions spec/bible_ref/languages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@
end
end

context 'given the book of Jude in English' do
subject { BibleRef::LANGUAGES.fetch('eng').new }

it 'has one chapter' do
expect(subject.has_single_chapter?('Jude 1:1')).to be_truthy
end
end

context 'given the book of Judges in Englsh' do
subject { BibleRef::LANGUAGES.fetch('eng').new }

it 'does not have one chapter' do
expect(subject.has_single_chapter?('Judges 1:1')).to be_falsey
end
end

end

end

0 comments on commit 3f87075

Please sign in to comment.