votd 3.0.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/LICENSE +1 -1
- data/README.md +26 -24
- data/exe/votd +7 -0
- data/lib/votd/base.rb +37 -22
- data/lib/votd/bible_gateway.rb +80 -72
- data/lib/votd/cli.rb +117 -0
- data/lib/votd/esvbible.rb +13 -49
- data/lib/votd/fetch_error.rb +8 -0
- data/lib/votd/helper/command_line.rb +9 -9
- data/lib/votd/helper/text.rb +9 -7
- data/lib/votd/netbible.rb +33 -29
- data/lib/votd/ourmanna.rb +45 -0
- data/lib/votd/version.rb +3 -1
- data/lib/votd/votd_error.rb +4 -0
- data/lib/votd.rb +42 -0
- metadata +37 -196
- data/.gitignore +0 -19
- data/.rspec +0 -2
- data/.ruby-version +0 -1
- data/.travis.yml +0 -11
- data/.yardopts +0 -7
- data/CONTRIBUTING.md +0 -46
- data/Gemfile +0 -4
- data/Guardfile +0 -10
- data/Rakefile +0 -13
- data/TODO.md +0 -5
- data/bin/votd +0 -25
- data/lib/votd/helper/helper.rb +0 -6
- data/spec/fixtures/base/base.html +0 -5
- data/spec/fixtures/base/base.txt +0 -1
- data/spec/fixtures/base/base_custom.html +0 -1
- data/spec/fixtures/base/base_custom.txt +0 -1
- data/spec/fixtures/bible_gateway/bible_gateway.html +0 -5
- data/spec/fixtures/bible_gateway/bible_gateway.rss +0 -33
- data/spec/fixtures/bible_gateway/bible_gateway.txt +0 -1
- data/spec/fixtures/bible_gateway/bible_gateway_custom.html +0 -1
- data/spec/fixtures/bible_gateway/bible_gateway_custom.txt +0 -1
- data/spec/fixtures/bible_gateway/bible_gateway_nlt.rss +0 -34
- data/spec/fixtures/bible_gateway/bible_gateway_with_partial.rss +0 -32
- data/spec/fixtures/esvbible/esvbible.html +0 -5
- data/spec/fixtures/esvbible/esvbible.rss +0 -19
- data/spec/fixtures/esvbible/esvbible.txt +0 -1
- data/spec/fixtures/esvbible/esvbible_custom.html +0 -1
- data/spec/fixtures/esvbible/esvbible_custom.txt +0 -1
- data/spec/fixtures/esvbible/esvbible_with_partial.rss +0 -19
- data/spec/fixtures/netbible/netbible.html +0 -5
- data/spec/fixtures/netbible/netbible.json +0 -14
- data/spec/fixtures/netbible/netbible.txt +0 -1
- data/spec/fixtures/netbible/netbible_custom.html +0 -1
- data/spec/fixtures/netbible/netbible_custom.txt +0 -1
- data/spec/fixtures/netbible/netbible_with_html.json +0 -1
- data/spec/fixtures/netbible/netbible_with_partial.json +0 -8
- data/spec/lib/votd/base_spec.rb +0 -96
- data/spec/lib/votd/bible_gateway_spec.rb +0 -161
- data/spec/lib/votd/esvbible_spec.rb +0 -127
- data/spec/lib/votd/helper/command_line_spec.rb +0 -21
- data/spec/lib/votd/helper/helper_spec.rb +0 -3
- data/spec/lib/votd/helper/text_spec.rb +0 -32
- data/spec/lib/votd/netbible_spec.rb +0 -135
- data/spec/lib/votd/version_spec.rb +0 -7
- data/spec/lib/votd/votd_error_spec.rb +0 -5
- data/spec/lib/votd_spec.rb +0 -4
- data/spec/spec_helper.rb +0 -26
- data/votd.gemspec +0 -29
data/CONTRIBUTING.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Contributing
|
|
2
|
-
|
|
3
|
-
Inside of VotD's source is a module with classes and files referring
|
|
4
|
-
to various Bible web services. By contributing to VotD with plugins you
|
|
5
|
-
can help keep the gem fresh with new versions.
|
|
6
|
-
|
|
7
|
-
The most basic way to get the code is to simply fork the code base on
|
|
8
|
-
GitHub. This will hand over a copy of the code to you so that you can
|
|
9
|
-
really do whatever you want.
|
|
10
|
-
|
|
11
|
-
To create a plugin, you must find an API and wrap it in a module
|
|
12
|
-
located in `lib/votd`.
|
|
13
|
-
|
|
14
|
-
* Your class must inherit from {Votd::Base} and
|
|
15
|
-
needs to override the {Votd::Base#get_votd} method.
|
|
16
|
-
|
|
17
|
-
* Your class must supply the `BIBLE_VERSION` constant, or set `@version` inside the class somewhere.
|
|
18
|
-
|
|
19
|
-
* Your initializer must consist of at least the following:
|
|
20
|
-
|
|
21
|
-
```ruby
|
|
22
|
-
# Initializes the MyBible class
|
|
23
|
-
def initialize
|
|
24
|
-
super
|
|
25
|
-
end
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Creating a new file in `spec` to test your plugin before your pull
|
|
29
|
-
request. VotD uses the testing framework [Rspec](http://rspec.info/)
|
|
30
|
-
to manage testing, so use the Rspec syntax enhancements rather than
|
|
31
|
-
another framework.
|
|
32
|
-
|
|
33
|
-
Once your tests are done, work on the parsing system with your code,
|
|
34
|
-
and you're ready to go!
|
|
35
|
-
|
|
36
|
-
Just pop us a [Pull Request](https://github.com/Sevenview/votd/pulls)
|
|
37
|
-
and you're code will be overviewed and ready to go soon.
|
|
38
|
-
|
|
39
|
-
## Summary
|
|
40
|
-
|
|
41
|
-
1. Fork it
|
|
42
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
43
|
-
3. Write passing tests/specs (we use [RSpec](http://rspec.info))
|
|
44
|
-
4. Commit your changes (`git commit -am 'Added some feature'`)
|
|
45
|
-
5. Push to the branch (`git push origin my-new-feature`)
|
|
46
|
-
6. Create new Pull Request
|
data/Gemfile
DELETED
data/Guardfile
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
guard 'bundler' do
|
|
2
|
-
watch('Gemfile')
|
|
3
|
-
watch(%r{^.+\.gemspec})
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
guard 'rspec', :version => 2, :cli => "--color --format documentation" do
|
|
7
|
-
watch(%r{^spec/.+_spec\.rb$})
|
|
8
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
|
9
|
-
watch('spec/spec_helper.rb') { "spec" }
|
|
10
|
-
end
|
data/Rakefile
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env rake
|
|
2
|
-
require "bundler/gem_tasks"
|
|
3
|
-
require "rspec/core/rake_task"
|
|
4
|
-
require "yard"
|
|
5
|
-
|
|
6
|
-
task :default => :spec
|
|
7
|
-
|
|
8
|
-
desc "Run RSpec tests [default]"
|
|
9
|
-
RSpec::Core::RakeTask.new
|
|
10
|
-
|
|
11
|
-
desc "Generate YARD docs"
|
|
12
|
-
YARD::Rake::YardocTask.new
|
|
13
|
-
|
data/TODO.md
DELETED
data/bin/votd
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
# allow this to run from development environment
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
|
5
|
-
|
|
6
|
-
require 'votd'
|
|
7
|
-
require 'votd/helper/command_line'
|
|
8
|
-
|
|
9
|
-
include Votd::Helper::CommandLine
|
|
10
|
-
|
|
11
|
-
votd = Votd::BibleGateway.new
|
|
12
|
-
#votd = Votd::NetBible.new
|
|
13
|
-
#votd = Votd::ESVBible.new
|
|
14
|
-
#votd = Votd::Base.new
|
|
15
|
-
|
|
16
|
-
LINE_WIDTH = 40
|
|
17
|
-
|
|
18
|
-
banner("VERSE OF THE DAY for #{votd.date.to_s}", LINE_WIDTH) { }
|
|
19
|
-
puts "\n"
|
|
20
|
-
puts word_wrap(votd.to_text, LINE_WIDTH)
|
|
21
|
-
|
|
22
|
-
if votd.copyright
|
|
23
|
-
puts "\n"
|
|
24
|
-
puts banner(word_wrap(votd.copyright, LINE_WIDTH), LINE_WIDTH)
|
|
25
|
-
end
|
data/lib/votd/helper/helper.rb
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<p class="votd-text">For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.</p>
|
|
2
|
-
<p>
|
|
3
|
-
<span class="votd-reference"><strong>John 3:16</strong></span>
|
|
4
|
-
<span class="votd-version"><em>(KJV)</em></span>
|
|
5
|
-
</p>
|
data/spec/fixtures/base/base.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life. -- John 3:16 (KJV)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<p>John 3:16|For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.|KJV</p>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
John 3:16|For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.|KJV
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" ?>
|
|
2
|
-
<rss version="2.0"
|
|
3
|
-
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
4
|
-
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
|
|
5
|
-
xmlns:admin="http://webns.net/mvcb/"
|
|
6
|
-
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
7
|
-
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
|
8
|
-
>
|
|
9
|
-
|
|
10
|
-
<channel>
|
|
11
|
-
<title>Bible Gateway's Verse of the Day</title>
|
|
12
|
-
<link>http://www.biblegateway.com</link>
|
|
13
|
-
<description>A daily word of exultation.</description>
|
|
14
|
-
<dc:language>en-us</dc:language>
|
|
15
|
-
<dc:creator>BibleGateway.com</dc:creator>
|
|
16
|
-
<dc:rights>Copyright 2004</dc:rights>
|
|
17
|
-
<dc:date>2012-03-25T12:00:00Z</dc:date>
|
|
18
|
-
<sy:updatePeriod>daily</sy:updatePeriod>
|
|
19
|
-
<sy:updateFrequency>1</sy:updateFrequency>
|
|
20
|
-
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
|
|
21
|
-
|
|
22
|
-
<item>
|
|
23
|
-
<title>1 John 1:9</title>
|
|
24
|
-
<description>Verse of the day</description>
|
|
25
|
-
<guid isPermaLink="false">http://www.biblegateway.com/passage/?search=1+John+1%3A9&version=NIV</guid>
|
|
26
|
-
<content:encoded>
|
|
27
|
-
<![CDATA[“If we confess our sins, he is faithful and just and will forgive us our sins and purify us from all unrighteousness.”<br/><br/> Brought to you by <a href="http://www.biblegateway.com">BibleGateway.com</a>. Copyright (C) . All Rights Reserved.]]>
|
|
28
|
-
</content:encoded>
|
|
29
|
-
<dc:rights>Powered by BibleGateway.com</dc:rights>
|
|
30
|
-
<dc:date>2012-03-25T12:00:00Z</dc:date>
|
|
31
|
-
</item>
|
|
32
|
-
</channel>
|
|
33
|
-
</rss>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
If we confess our sins, he is faithful and just and will forgive us our sins and purify us from all unrighteousness. -- 1 John 1:9 (NIV)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<p>1 John 1:9|If we confess our sins, he is faithful and just and will forgive us our sins and purify us from all unrighteousness.|NIV</p>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1 John 1:9|If we confess our sins, he is faithful and just and will forgive us our sins and purify us from all unrighteousness.|NIV
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<?xml version="1.0" ?>
|
|
3
|
-
<rss version="2.0"
|
|
4
|
-
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
5
|
-
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
|
|
6
|
-
xmlns:admin="http://webns.net/mvcb/"
|
|
7
|
-
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
8
|
-
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
|
9
|
-
>
|
|
10
|
-
|
|
11
|
-
<channel>
|
|
12
|
-
<title>Bible Gateway's Verse of the Day</title>
|
|
13
|
-
<link>https://www.biblegateway.com</link>
|
|
14
|
-
<description>A daily word of exultation.</description>
|
|
15
|
-
<dc:language>en-us</dc:language>
|
|
16
|
-
<dc:creator>BibleGateway.com</dc:creator>
|
|
17
|
-
<dc:rights>Copyright 2004</dc:rights>
|
|
18
|
-
<dc:date>2019-11-27T12:00:00Z</dc:date>
|
|
19
|
-
<sy:updatePeriod>daily</sy:updatePeriod>
|
|
20
|
-
<sy:updateFrequency>1</sy:updateFrequency>
|
|
21
|
-
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
|
|
22
|
-
|
|
23
|
-
<item>
|
|
24
|
-
<title>Colossians 3:16</title>
|
|
25
|
-
<description>Verse of the day</description>
|
|
26
|
-
<guid isPermaLink="false">https://www.biblegateway.com/passage/?search=Colossians+3%3A16&version=51</guid>
|
|
27
|
-
<content:encoded>
|
|
28
|
-
<![CDATA[“Let the message about Christ, in all its richness, fill your lives. Teach and counsel each other with all the wisdom he gives. Sing psalms and hymns and spiritual songs to God with thankful hearts.”<br/><br/> Brought to you by <a href="https://www.biblegateway.com">BibleGateway.com</a>. Copyright (C) NLT. All Rights Reserved.]]>
|
|
29
|
-
</content:encoded>
|
|
30
|
-
<dc:rights>Powered by BibleGateway.com</dc:rights>
|
|
31
|
-
<dc:date>2019-11-27T12:00:00Z</dc:date>
|
|
32
|
-
</item>
|
|
33
|
-
</channel>
|
|
34
|
-
</rss>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" ?>
|
|
2
|
-
<rss version="2.0"
|
|
3
|
-
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
4
|
-
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
|
|
5
|
-
xmlns:admin="http://webns.net/mvcb/"
|
|
6
|
-
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
7
|
-
xmlns:content="http://purl.org/rss/1.0/modules/content/">
|
|
8
|
-
|
|
9
|
-
<channel>
|
|
10
|
-
<title>Bible Gateway's Verse of the Day</title>
|
|
11
|
-
<link>http://www.biblegateway.com</link>
|
|
12
|
-
<description>A daily word of exultation.</description>
|
|
13
|
-
<dc:language>en-us</dc:language>
|
|
14
|
-
<dc:creator>BibleGateway.com</dc:creator>
|
|
15
|
-
<dc:rights>Copyright 2004</dc:rights>
|
|
16
|
-
<dc:date>2012-03-25T12:00:00Z</dc:date>
|
|
17
|
-
<sy:updatePeriod>daily</sy:updatePeriod>
|
|
18
|
-
<sy:updateFrequency>1</sy:updateFrequency>
|
|
19
|
-
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
|
|
20
|
-
|
|
21
|
-
<item>
|
|
22
|
-
<title>1 John 1:9</title>
|
|
23
|
-
<description>Verse of the day</description>
|
|
24
|
-
<guid isPermaLink="false">http://www.biblegateway.com/passage/?search=1+John+1%3A9&version=NIV</guid>
|
|
25
|
-
<content:encoded>
|
|
26
|
-
<![CDATA[“if we confess our sins, he is faithful and just and will forgive us our sins and purify us from all unrighteousness”<br/><br/> Brought to you by <a href="http://www.biblegateway.com">BibleGateway.com</a>. Copyright (C) . All Rights Reserved.]]>
|
|
27
|
-
</content:encoded>
|
|
28
|
-
<dc:rights>Powered by BibleGateway.com</dc:rights>
|
|
29
|
-
<dc:date>2012-03-25T12:00:00Z</dc:date>
|
|
30
|
-
</item>
|
|
31
|
-
</channel>
|
|
32
|
-
</rss>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<p class="votd-text">For you did not receive the spirit of slavery to fall back into fear, but you have received the Spirit of adoption as sons, by whom we cry, "Abba! Father!"</p>
|
|
2
|
-
<p>
|
|
3
|
-
<span class="votd-reference"><strong>Romans 8:15</strong></span>
|
|
4
|
-
<span class="votd-version"><em>(ESV)</em></span>
|
|
5
|
-
</p>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<rss version="2.0">
|
|
2
|
-
<channel>
|
|
3
|
-
<title>English Standard Version Bible Daily Verse</title>
|
|
4
|
-
<link>http://www.gnpcb.org/esv/share/rss2.0/</link>
|
|
5
|
-
<description>A daily verse from the ESV Bible.</description>
|
|
6
|
-
<webMaster>webmaster@crossway.org</webMaster>
|
|
7
|
-
<copyright>The Holy Bible, English Standard Version copyright 2001 by Crossway Bibles,
|
|
8
|
-
a publishing ministry of Good News Publishers. Used by permission. All rights reserved.
|
|
9
|
-
</copyright>
|
|
10
|
-
<ttl>1440</ttl>
|
|
11
|
-
<item>
|
|
12
|
-
<title>Romans 8:15</title>
|
|
13
|
-
<link>http://www.gnpcb.org/esv/search/?passage=Romans+8%3A15</link>
|
|
14
|
-
<guid isPermaLink="false">http://www.gnpcb.org/esv/search/?passage=Romans+8%3A15&date=20131029</guid>
|
|
15
|
-
<pubDate>Tue, 29 Oct 2013 00:01:00 -0500</pubDate>
|
|
16
|
-
<description>For you did not receive the spirit of slavery to fall back into fear, but you have received the Spirit of adoption as sons, by whom we cry, "Abba! Father!"</description>
|
|
17
|
-
</item>
|
|
18
|
-
</channel>
|
|
19
|
-
</rss>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
For you did not receive the spirit of slavery to fall back into fear, but you have received the Spirit of adoption as sons, by whom we cry, "Abba! Father!" -- Romans 8:15 (ESV)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<p>Romans 8:15|For you did not receive the spirit of slavery to fall back into fear, but you have received the Spirit of adoption as sons, by whom we cry, "Abba! Father!"|ESV</p>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Romans 8:15|For you did not receive the spirit of slavery to fall back into fear, but you have received the Spirit of adoption as sons, by whom we cry, "Abba! Father!"|ESV
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<rss version="2.0">
|
|
2
|
-
<channel>
|
|
3
|
-
<title>English Standard Version Bible Daily Verse</title>
|
|
4
|
-
<link>http://www.gnpcb.org/esv/share/rss2.0/</link>
|
|
5
|
-
<description>A daily verse from the ESV Bible.</description>
|
|
6
|
-
<webMaster>webmaster@crossway.org</webMaster>
|
|
7
|
-
<copyright>The Holy Bible, English Standard Version copyright 2001 by Crossway Bibles,
|
|
8
|
-
a publishing ministry of Good News Publishers. Used by permission. All rights reserved.
|
|
9
|
-
</copyright>
|
|
10
|
-
<ttl>1440</ttl>
|
|
11
|
-
<item>
|
|
12
|
-
<title>Romans 8:15</title>
|
|
13
|
-
<link>http://www.gnpcb.org/esv/search/?passage=Romans+8%3A15</link>
|
|
14
|
-
<guid isPermaLink="false">http://www.gnpcb.org/esv/search/?passage=Romans+8%3A15&date=20131029</guid>
|
|
15
|
-
<pubDate>Tue, 29 Oct 2013 00:01:00 -0500</pubDate>
|
|
16
|
-
<description>for you did not receive the spirit of slavery to fall back into fear, but you have received the Spirit of adoption as sons, by whom we cry, "Abba! Father</description>
|
|
17
|
-
</item>
|
|
18
|
-
</channel>
|
|
19
|
-
</rss>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"bookname": "Ephesians",
|
|
4
|
-
"chapter": "2",
|
|
5
|
-
"verse": "8",
|
|
6
|
-
"text": "For by grace you are saved through faith..."
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"bookname": "Ephesians",
|
|
10
|
-
"chapter": "2",
|
|
11
|
-
"verse": "9",
|
|
12
|
-
"text": "it is not from works, so that no one can boast."
|
|
13
|
-
}
|
|
14
|
-
]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
For by grace you are saved through faith... it is not from works, so that no one can boast. -- Ephesians 2:8-9 (NETBible)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<p>Ephesians 2:8-9|For by grace you are saved through faith... it is not from works, so that no one can boast.|NETBible</p>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Ephesians 2:8-9|For by grace you are saved through faith... it is not from works, so that no one can boast.|NETBible
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"bookname":"Matthew","chapter":"4","verse":"4","text":"But he answered, \u201cIt is written, \u2018Man<\/b> does not live<\/b> by bread alone, but by every word that comes from the mouth of God<\/b>.\u2019\u201d"}]
|
data/spec/lib/votd/base_spec.rb
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe "Votd::Base" do
|
|
4
|
-
let(:votd) { Votd::Base.new }
|
|
5
|
-
|
|
6
|
-
describe ".text" do
|
|
7
|
-
it "returns the default scripture verse" do
|
|
8
|
-
expect(votd.text).to eq "For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life."
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe ".reference" do
|
|
13
|
-
it "returns the default scripture reference" do
|
|
14
|
-
expect(votd.reference).to eq "John 3:16"
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe ".version / .translation" do
|
|
19
|
-
it "returns the default bible version" do
|
|
20
|
-
expect(votd.translation).to eq "KJV"
|
|
21
|
-
expect(votd.version).to eq "KJV"
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe ".version_name / .translation_name" do
|
|
26
|
-
it "returns the default bible version" do
|
|
27
|
-
expect(votd.translation_name).to eq "King James Version"
|
|
28
|
-
expect(votd.version_name).to eq "King James Version"
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
describe ".link" do
|
|
33
|
-
it 'returns the default link' do
|
|
34
|
-
expect(votd.link).to eq 'https://www.biblegateway.com/passage/?search=John+3%3A16&version=KJV'
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
describe ".date" do
|
|
39
|
-
it "returns the default date" do
|
|
40
|
-
expect(votd.date).to eq Date.today
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
describe ".copyright" do
|
|
45
|
-
it "returns nil copyright information" do
|
|
46
|
-
expect(votd.copyright).to be_nil
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
describe ".to_html" do
|
|
51
|
-
it "returns a HTML version" do
|
|
52
|
-
expect(votd.to_html).to eq read_fixture("base/base.html")
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
describe ".custom_html" do
|
|
57
|
-
it "returns custom HTML and overrides the default .to_html formatting" do
|
|
58
|
-
html_from_block = votd.custom_html do |votd|
|
|
59
|
-
"<p>#{votd.reference}|#{votd.text}|#{votd.version}</p>"
|
|
60
|
-
end
|
|
61
|
-
desired_output = read_fixture("base/base_custom.html")
|
|
62
|
-
expect(html_from_block).to eq desired_output
|
|
63
|
-
expect(votd.to_html).to eq desired_output
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
it "generates a VotdError when not used with a block" do
|
|
67
|
-
expect{votd.custom_html}.to raise_error(Votd::VotdError)
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
describe ".to_text" do
|
|
72
|
-
it "returns a text-formatted version" do
|
|
73
|
-
expect(votd.to_text).to eq read_fixture("base/base.txt")
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
it "is aliased to .to_s" do
|
|
77
|
-
expect(votd.to_s).to eq read_fixture("base/base.txt")
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
describe ".custom_text" do
|
|
82
|
-
it "overrides the default.to_text formatting" do
|
|
83
|
-
text_from_block = votd.custom_text do |votd|
|
|
84
|
-
"#{votd.reference}|#{votd.text}|#{votd.version}"
|
|
85
|
-
end
|
|
86
|
-
desired_output = read_fixture("base/base_custom.txt")
|
|
87
|
-
expect(text_from_block).to eq desired_output
|
|
88
|
-
expect(votd.to_text).to eq desired_output
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
it "generates a VotdError when not used with a block" do
|
|
92
|
-
expect{votd.custom_text}.to raise_error(Votd::VotdError)
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
end
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe "Votd::BibleGateway" do
|
|
4
|
-
let(:votd) { Votd::BibleGateway.new }
|
|
5
|
-
let(:votd_nlt) { Votd::BibleGateway.new(:nlt) }
|
|
6
|
-
|
|
7
|
-
let(:uri_regex) { /#{Votd::BibleGateway::URI}\d*/ }
|
|
8
|
-
|
|
9
|
-
context 'With the default version' do
|
|
10
|
-
before do
|
|
11
|
-
fake_a_uri(uri_regex, "bible_gateway/bible_gateway.rss")
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "is a type of BibleGateway" do
|
|
15
|
-
expect(votd).to be_a(Votd::BibleGateway)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe ".text" do
|
|
19
|
-
it "returns the correct scripture verse" do
|
|
20
|
-
expect(votd.text).to eq "If we confess our sins, he is faithful and just and will forgive us our sins and purify us from all unrighteousness."
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
describe ".reference" do
|
|
25
|
-
it "returns the correct scripture reference" do
|
|
26
|
-
expect(votd.reference).to eq "1 John 1:9"
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe ".version / .translation" do
|
|
31
|
-
it "returns the correct bible version" do
|
|
32
|
-
expect(votd.version).to eq "NIV"
|
|
33
|
-
expect(votd.translation).to eq "NIV"
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
describe ".version_name / .translation_name" do
|
|
38
|
-
it "returns the correct bible version name" do
|
|
39
|
-
expect(votd.version_name).to eq "New International Version"
|
|
40
|
-
expect(votd.translation_name).to eq "New International Version"
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
describe ".date" do
|
|
45
|
-
it "returns the correct date" do
|
|
46
|
-
expect(votd.date).to eq Date.today
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
describe ".copyright" do
|
|
51
|
-
it "returns copyright information" do
|
|
52
|
-
expect(votd.copyright).to eq "Brought to you by BibleGateway.com. Copyright (C) . All Rights Reserved."
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
describe ".link" do
|
|
57
|
-
it 'returns the link' do
|
|
58
|
-
expect(votd.link).to eq 'http://www.biblegateway.com/passage/?search=1+John+1%3A9&version=NIV'
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
describe ".to_html" do
|
|
63
|
-
it "returns a HTML version" do
|
|
64
|
-
expect(votd.to_html).to eq read_fixture("bible_gateway/bible_gateway.html")
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
describe ".custom_html" do
|
|
69
|
-
it "overrides the default .to_html formatting" do
|
|
70
|
-
votd.custom_html do |votd|
|
|
71
|
-
"<p>#{votd.reference}|#{votd.text}|#{votd.version}</p>"
|
|
72
|
-
end
|
|
73
|
-
expect(votd.to_html).to eq read_fixture("bible_gateway/bible_gateway_custom.html")
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
it "generates a VotdError when not used with a block" do
|
|
77
|
-
expect{votd.custom_html}.to raise_error(Votd::VotdError)
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
describe ".to_text" do
|
|
82
|
-
it "returns a text-formatted version" do
|
|
83
|
-
expect(votd.to_text).to eq read_fixture("bible_gateway/bible_gateway.txt")
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
it "is aliased to .to_s" do
|
|
87
|
-
expect(votd.to_s).to eq read_fixture("bible_gateway/bible_gateway.txt")
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
describe ".custom_text" do
|
|
92
|
-
it "overrides the default.to_text formatting" do
|
|
93
|
-
text_from_block = votd.custom_text do |votd|
|
|
94
|
-
"#{votd.reference}|#{votd.text}|#{votd.version}"
|
|
95
|
-
end
|
|
96
|
-
desired_output = read_fixture("bible_gateway/bible_gateway_custom.txt")
|
|
97
|
-
expect(text_from_block).to eq desired_output
|
|
98
|
-
expect(votd.to_text).to eq desired_output
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
it "generates a VotdError when not used with a block" do
|
|
102
|
-
expect{votd.custom_text}.to raise_error(Votd::VotdError)
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
context "When an error occurrs" do
|
|
108
|
-
before do
|
|
109
|
-
fake_a_broken_uri(uri_regex)
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
it "falls back to default VotD values" do
|
|
113
|
-
expect(votd.version).to eq Votd::Base::DEFAULT_BIBLE_VERSION
|
|
114
|
-
expect(votd.reference).to eq Votd::Base::DEFAULT_BIBLE_REFERENCE
|
|
115
|
-
expect(votd.text).to eq Votd::Base::DEFAULT_BIBLE_TEXT
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
context "When the text is not a proper sentence" do
|
|
120
|
-
before do
|
|
121
|
-
fake_a_uri(uri_regex, "bible_gateway/bible_gateway_with_partial.rss")
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
it "prepends an ellipsis if first letter is not a capital letter" do
|
|
125
|
-
expect(votd.text).to match /^\.{3}\w/
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
it "appends an ellipsis if last character is not a period" do
|
|
129
|
-
expect(votd.text).to match /ness\.{3}$/
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
context 'When specifying a version' do
|
|
134
|
-
before do
|
|
135
|
-
fake_a_uri("#{Votd::BibleGateway::URI}#{51}", 'bible_gateway/bible_gateway_nlt.rss')
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
it "returns the correct scripture verse" do
|
|
139
|
-
expect(votd_nlt.text).to eq "Let the message about Christ, in all its richness, fill your lives. Teach and counsel each other with all the wisdom he gives. Sing psalms and hymns and spiritual songs to God with thankful hearts."
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
it 'returns the correct version info' do
|
|
143
|
-
expect(votd_nlt.version).to eq 'NLT'
|
|
144
|
-
expect(votd_nlt.version_name).to eq 'New Living Translation'
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
it "returns copyright information" do
|
|
148
|
-
expect(votd_nlt.copyright).to eq "Brought to you by BibleGateway.com. Copyright (C) NLT. All Rights Reserved."
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
it 'returns the link' do
|
|
152
|
-
expect(votd_nlt.link).to eq 'https://www.biblegateway.com/passage/?search=Colossians+3%3A16&version=51'
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
context 'with an invalid version code' do
|
|
156
|
-
it 'throws an error' do
|
|
157
|
-
expect{ Votd::BibleGateway.new(:foo) }.to raise_error(Votd::InvalidBibleVersion)
|
|
158
|
-
end
|
|
159
|
-
end
|
|
160
|
-
end
|
|
161
|
-
end
|