Skip to content

Commit

Permalink
Fixing CI issue
Browse files Browse the repository at this point in the history
  • Loading branch information
k-rudy committed Apr 23, 2014
1 parent 3eddb29 commit e9cdb98
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 75 deletions.
103 changes: 51 additions & 52 deletions config/application.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,54 @@ sources:
ru:
url: http://google.com
mappings:
mappings:
gn: ge
lv: le
nm: nu
dt: de
jgs: jud
1sm: 1ki
2sm: 2ki
1kgs: 3ki
2kgs: 4ki
1chr: 1ch
2chr: 2ch
neh: ne
tb: tob
est: es
1mc: 1ma
2mc: 2ma
jb: job
prv: pr
eccl: ec
sg: so
is: isa
lam: la
ez: ezr
dn: da
hos: ho
jl: joe
mi: mic
hb: hab
zep: sof
hg: hag
mk: mr
lk: lu
jn: joh
acts: ac
rom: ro
1cor: 1co
2cor: 2co
gal: ga
phil: php
1thes: 1th
2thes: 2th
1tm: 1ti
2tm: 2ti
ti: tit
phlm: phm
1pt: 1pe
2pt: 2pe
1jn: 1jo
2jn: 2jo
3jn: 3jo
rev: re
gn: ge
lv: le
nm: nu
dt: de
jgs: jud
1sm: 1ki
2sm: 2ki
1kgs: 3ki
2kgs: 4ki
1chr: 1ch
2chr: 2ch
neh: ne
tb: tob
est: es
1mc: 1ma
2mc: 2ma
jb: job
prv: pr
eccl: ec
sg: so
is: isa
lam: la
ez: ezr
dn: da
hos: ho
jl: joe
mi: mic
hb: hab
zep: sof
hg: hag
mk: mr
lk: lu
jn: joh
acts: ac
rom: ro
1cor: 1co
2cor: 2co
gal: ga
phil: php
1thes: 1th
2thes: 2th
1tm: 1ti
2tm: 2ti
ti: tit
phlm: phm
1pt: 1pe
2pt: 2pe
1jn: 1jo
2jn: 2jo
3jn: 3jo
rev: re
26 changes: 17 additions & 9 deletions spec/libs/bible/scrapers/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,36 +140,44 @@
end

describe '#book_mapping' do

before { subject.stub(translation: 'ru') }

context 'when there is no mapping defined' do

before do
book.stub(title: 'Le')
subject.stub(translation: 'ru')
end
before { book.stub(title: 'Le') }

it 'returns downcased book title' do
expect(subject.send(:book_mapping, book)).to eq('le')
end
end

context 'when there is a mapping for the book' do

before { book.stub(title: 'Gn') }

it 'returns mapping value' do
expect(subject.send(:book_mapping, book)).to eq('ge')
end
end
end

describe '#missing_mappings' do

let(:genesis) { build(:book, title: 'Zx') }
let(:genesis) { build(:book, title: 'Gn') }
let(:leviticus) { build(:book, title: 'Le') }
let(:numbers) { build(:book, title: 'Nd') }
let(:numbers) { build(:book, title: 'Nm') }

before do
subject.stub(translation: 'ru')
subject.stub(:scrape_verse).with('zx', 1, 2).and_return('Genesis')
subject.stub(:scrape_verse).with('ge', 1, 2).and_return('Genesis')
subject.stub(:scrape_verse).with('le', 1, 2).and_return(nil)
subject.stub(:scrape_verse).with('nd', 1, 2).and_raise(OpenURI::HTTPError.new('error', nil))
subject.stub(:scrape_verse).with('nu', 1, 2).and_raise(OpenURI::HTTPError.new('error', nil))
Bible::Book.stub(all: [ genesis, leviticus, numbers ])
end

it 'returns the list of books that need mapping' do
expect(subject.missing_mappings).to eq([ 'Le', 'Nd' ])
expect(subject.missing_mappings).to eq([ 'Le', 'Nm' ])
end
end

Expand Down
14 changes: 0 additions & 14 deletions spec/libs/bible/scrapers/ru_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,6 @@

subject { Bible::Scrapers::Ru }

describe '#book_mapping' do

let(:book) { double('book', chapters_count: 1) }

context 'when there is a mapping for the book' do

before { book.stub(title: 'Gn') }

it 'returns mapping value' do
expect(subject.send(:book_mapping, book)).to eq('ge')
end
end
end

describe '#scrape_verse' do

context 'Offline test' do
Expand Down

0 comments on commit e9cdb98

Please sign in to comment.