lyrics_finder 0.0.2 → 0.0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -13
- data/bin/lyricsfinder +1 -1
- data/lib/lyrics_finder/cli.rb +9 -7
- data/lib/lyrics_finder/providers/azlyrics.rb +12 -10
- data/lib/lyrics_finder/providers/lyrics_wikia.rb +12 -10
- data/lib/lyrics_finder/providers/song_lyrics.rb +12 -10
- data/lib/lyrics_finder/providers.rb +16 -14
- data/lib/lyrics_finder/song.rb +17 -15
- data/lib/lyrics_finder/version.rb +1 -1
- data/lib/lyrics_finder.rb +42 -40
- data/spec/lyrics_finder/lyrics_finder_spec.rb +13 -13
- data/spec/lyrics_finder/providers/azlyrics_spec.rb +3 -3
- data/spec/lyrics_finder/providers/lyrics_wikia_spec.rb +5 -5
- data/spec/lyrics_finder/providers/song_lyrics_spec.rb +3 -3
- data/spec/lyrics_finder/providers_spec.rb +4 -4
- metadata +1 -11
- data/spec/vcr_cassettes/Azlyrics_200_search.yml +0 -153
- data/spec/vcr_cassettes/LyricsWikia_200_search.yml +0 -1968
- data/spec/vcr_cassettes/LyricsWikia_Song_does_not_exist_search.yml +0 -631
- data/spec/vcr_cassettes/Nonexistent_Song_404_search.yml +0 -3952
- data/spec/vcr_cassettes/SongLyrics_200_search.yml +0 -2274
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18fb39d6218af131f95a5f89a8fa9e3e13c60016
|
4
|
+
data.tar.gz: 7b5240100f25a8c0001c19a4427f45853346f785
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7f9660235e0f0d67af718ddb9646f5ebaacee41f1af025be16dffa38af7ff09fb1e6cf743789b471bac74535386424aa818cd140842cface9f904e1cb6f05f0
|
7
|
+
data.tar.gz: e4a45e2bdc8d6c0cb17aa6c25016bf4f1093bacfe4129468774aa5cee818ea0214de95d238bc2bb92c4a1875def4df931eab68d8bc44e4ab3bbd172bff8d7236
|
data/README.md
CHANGED
@@ -18,16 +18,25 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Hello World!
|
20
20
|
|
21
|
-
Create an instance of `Finder`:
|
21
|
+
Create an instance of `Lyrics::Finder`:
|
22
22
|
|
23
23
|
```ruby
|
24
|
-
finder = Finder.new
|
24
|
+
finder = Lyrics::Finder.new
|
25
25
|
```
|
26
26
|
|
27
|
-
|
27
|
+
And search passing the author and the song title as parameters to `Lyrics::Finder#search`:
|
28
28
|
|
29
29
|
```ruby
|
30
|
-
finder
|
30
|
+
finder.search 'idina menzel', 'let it go'
|
31
|
+
```
|
32
|
+
Which will return and array with all the verses of the song as strings, or `nil` if the song cannot be found.
|
33
|
+
|
34
|
+
### Customizing the search
|
35
|
+
|
36
|
+
You can specify which websites do you want to get the lyrics from (all by default):
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
finder = Lyrics::Finder.new(:song_lyrics, :azlyrics)
|
31
40
|
```
|
32
41
|
|
33
42
|
You can choose among the following:
|
@@ -36,20 +45,13 @@ You can choose among the following:
|
|
36
45
|
- SongLyrics (`:song_lyrics`)
|
37
46
|
- AZLyrics (`:azlyrics`)
|
38
47
|
|
39
|
-
And search passing the author and the song title as parameters to `Finder#search`:
|
40
|
-
|
41
|
-
```ruby
|
42
|
-
finder.search 'idina menzel', 'let it go'
|
43
|
-
```
|
44
|
-
Which will return and array with all the verses of the song as strings, or `nil` if it cannot found the song in any of the websites.
|
45
|
-
|
46
48
|
## Example
|
47
49
|
|
48
50
|
In your ruby apps:
|
49
51
|
```ruby
|
50
52
|
require 'lyrics_finder'
|
51
53
|
|
52
|
-
finder = Finder.new
|
54
|
+
finder = Lyrics::Finder.new
|
53
55
|
@song = finder.search 'idina menzel', 'let it go'
|
54
56
|
puts @song
|
55
57
|
```
|
@@ -62,6 +64,10 @@ LyricsFinder is also available as a command-line tool.
|
|
62
64
|
|
63
65
|
## Changelog
|
64
66
|
|
67
|
+
v 0.0.3
|
68
|
+
|
69
|
+
- Wrapped everything into a `Lyrics` module.
|
70
|
+
|
65
71
|
v 0.0.2
|
66
72
|
|
67
73
|
- Changed the app interface `LyricsFinder::Fetcher` is now `Finder`.
|
@@ -78,4 +84,8 @@ v 0.0.1
|
|
78
84
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
79
85
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
80
86
|
4. Push to the branch (`git push origin my-new-feature`)
|
81
|
-
5. Create a new Pull Request
|
87
|
+
5. Create a new Pull Request
|
88
|
+
|
89
|
+
## Credits
|
90
|
+
|
91
|
+
Inspired by [Lyricfy](https://github.com/javichito/Lyricfy).
|
data/bin/lyricsfinder
CHANGED
data/lib/lyrics_finder/cli.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'lyrics_finder'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
module Lyrics
|
5
|
+
class CLI < Thor
|
6
|
+
desc 'search -a Author -t Song Title', 'Search the lyrics for the specified author and title'
|
7
|
+
method_option 'author', :aliases => '-a', :type => :string
|
8
|
+
method_option 'title', :aliases => '-t', :type => :string
|
9
|
+
def search
|
10
|
+
finder = Lyrics::Finder.new
|
11
|
+
puts finder.search(options[:author], options[:title])
|
12
|
+
end
|
11
13
|
end
|
12
14
|
end
|
@@ -1,14 +1,16 @@
|
|
1
|
-
module
|
2
|
-
|
1
|
+
module Lyrics
|
2
|
+
module Providers::Azlyrics
|
3
|
+
include Contracts
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
Contract Lyrics::Song => String
|
6
|
+
def self.format_url(song)
|
7
|
+
song.format_attributes_with_separator!("")
|
8
|
+
"http://www.azlyrics.com/lyrics/#{song.author}/#{song.title}.html"
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
Contract Tempfile => Or[Array, nil]
|
12
|
+
def self.extract_lyric(data)
|
13
|
+
Lyrics::Providers.extract_lyrics_at_css_from_data('div:nth-child(7)', data)
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
@@ -1,14 +1,16 @@
|
|
1
|
-
module
|
2
|
-
|
1
|
+
module Lyrics
|
2
|
+
module Providers::LyricsWikia
|
3
|
+
include Contracts
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
Contract Lyrics::Song => String
|
6
|
+
def self.format_url(song)
|
7
|
+
song.format_attributes_with_separator!("_")
|
8
|
+
"http://lyrics.wikia.com/#{song.author}:#{song.title}"
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
Contract Tempfile => Or[Array, nil]
|
12
|
+
def self.extract_lyric(data)
|
13
|
+
Lyrics::Providers.extract_lyrics_at_css_from_data('.lyricbox', data)
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
@@ -1,14 +1,16 @@
|
|
1
|
-
module
|
2
|
-
|
1
|
+
module Lyrics
|
2
|
+
module Providers::SongLyrics
|
3
|
+
include Contracts
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
Contract Lyrics::Song => String
|
6
|
+
def self.format_url(song)
|
7
|
+
song.format_attributes_with_separator!("-")
|
8
|
+
"http://www.songlyrics.com/#{song.author}/#{song.title}-lyrics/"
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
Contract Tempfile => Or[Array, nil]
|
12
|
+
def self.extract_lyric(data)
|
13
|
+
Lyrics::Providers.extract_lyrics_at_css_from_data('#songLyricsDiv', data)
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
@@ -1,21 +1,23 @@
|
|
1
1
|
require_relative 'song'
|
2
2
|
|
3
|
-
module
|
4
|
-
|
3
|
+
module Lyrics
|
4
|
+
module Providers
|
5
|
+
include Contracts
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
Contract Symbol => Module
|
8
|
+
def self.build_klass(provider)
|
9
|
+
klass = "Lyrics::Providers::" + provider.to_s.camelize
|
10
|
+
klass.constantize
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
def self.extract_lyrics_at_css_from_data(css_element, data)
|
14
|
+
html = Nokogiri::HTML(data)
|
15
|
+
lyrics_container = html.css(css_element).first
|
16
|
+
unless lyrics_container.nil?
|
17
|
+
elements = lyrics_container.children.to_a
|
18
|
+
phrases = elements.select { |el| el.text? && el.text != "\n" && !el.blank? }
|
19
|
+
phrases.map! { |element| element.text.strip }
|
20
|
+
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
data/lib/lyrics_finder/song.rb
CHANGED
@@ -1,21 +1,23 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Lyrics
|
2
|
+
class Song
|
3
|
+
attr_accessor :author, :title
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
def initialize(author, title)
|
6
|
+
@author = author
|
7
|
+
@title = title
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
def self.valid?(val)
|
11
|
+
val.is_a?(Song) && !val.author.blank? && !val.title.blank?
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
def self.to_s
|
15
|
+
"a valid author and song title please"
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
def format_attributes_with_separator!(separator)
|
19
|
+
self.author = I18n.transliterate(@author.strip.gsub(" ", separator))
|
20
|
+
self.title = I18n.transliterate(@title.strip.gsub(" ", separator))
|
21
|
+
end
|
20
22
|
end
|
21
23
|
end
|
data/lib/lyrics_finder.rb
CHANGED
@@ -1,53 +1,55 @@
|
|
1
1
|
require_relative 'lyrics_finder/dependencies'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
module Lyrics
|
4
|
+
class Finder
|
5
|
+
include Contracts
|
6
|
+
PROVIDERS_LIST = [:lyrics_wikia, :song_lyrics, :azlyrics]
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def selected_providers
|
12
|
-
@providers
|
13
|
-
end
|
8
|
+
def initialize(*args)
|
9
|
+
@providers = filter_providers(args)
|
10
|
+
end
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
12
|
+
def selected_providers
|
13
|
+
@providers
|
14
|
+
end
|
19
15
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
klass = Providers.build_klass(provider)
|
25
|
-
url = klass.format_url(song)
|
16
|
+
def search(author, title)
|
17
|
+
song = Song.new(author, title)
|
18
|
+
perform_search(song)
|
19
|
+
end
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
21
|
+
Contract Lyrics::Song => Or[Array, nil]
|
22
|
+
def perform_search(song)
|
23
|
+
song_lyric = catch(:song_lyric) {
|
24
|
+
@providers.each do |provider|
|
25
|
+
klass = Providers.build_klass(provider)
|
26
|
+
url = klass.format_url(song)
|
27
|
+
|
28
|
+
data = perform_request(url)
|
29
|
+
result = klass.extract_lyric(data) if data
|
30
|
+
throw :song_lyric, result unless result.nil?
|
31
|
+
end
|
32
|
+
}
|
33
|
+
# because if it doesn't find anything returns @providers by default
|
34
|
+
song_lyric != @providers ? song_lyric : nil
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
+
private
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
def filter_providers(providers)
|
40
|
+
valid_providers = []
|
41
|
+
providers.each do |provider|
|
42
|
+
valid_providers << provider if PROVIDERS_LIST.include?(provider)
|
43
|
+
end
|
44
|
+
valid_providers.any? ? valid_providers : PROVIDERS_LIST
|
42
45
|
end
|
43
|
-
valid_providers.any? ? valid_providers : PROVIDERS_LIST
|
44
|
-
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
def perform_request(url)
|
48
|
+
begin
|
49
|
+
open(url)
|
50
|
+
rescue Exception => ex
|
51
|
+
# puts "ERROR: " + ex.message
|
52
|
+
end
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
describe Finder do
|
1
|
+
describe Lyrics::Finder do
|
2
2
|
describe 'sets @providers properly on initialization' do
|
3
3
|
context 'without specifying providers' do
|
4
|
-
let(:finder) { Finder.new }
|
4
|
+
let(:finder) { Lyrics::Finder.new }
|
5
5
|
|
6
6
|
it 'sets @providers to default PROVIDERS_LIST' do
|
7
|
-
expect(finder.selected_providers).to eq Finder::PROVIDERS_LIST
|
7
|
+
expect(finder.selected_providers).to eq Lyrics::Finder::PROVIDERS_LIST
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
context 'specifying providers' do
|
12
12
|
context 'some providers are invalid' do
|
13
|
-
let(:finder) { Finder.new(:lyrics_wikia, :bad_songs) }
|
13
|
+
let(:finder) { Lyrics::Finder.new(:lyrics_wikia, :bad_songs) }
|
14
14
|
|
15
15
|
it 'filters invalid providers' do
|
16
16
|
expect(finder.selected_providers).to match_array [:lyrics_wikia]
|
@@ -18,10 +18,10 @@ describe Finder do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
context 'all providers are invalid' do
|
21
|
-
let(:finder) { Finder.new(:bad_songs, :invalid_songs) }
|
21
|
+
let(:finder) { Lyrics::Finder.new(:bad_songs, :invalid_songs) }
|
22
22
|
|
23
23
|
it 'sets @providers to default PROVIDERS_LIST' do
|
24
|
-
expect(finder.selected_providers).to eq Finder::PROVIDERS_LIST
|
24
|
+
expect(finder.selected_providers).to eq Lyrics::Finder::PROVIDERS_LIST
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -31,7 +31,7 @@ describe Finder do
|
|
31
31
|
describe 'using LyricsWikia as the provider' do
|
32
32
|
context 'with a song that can be found' do
|
33
33
|
before :each do
|
34
|
-
@finder = Finder.new(:lyrics_wikia)
|
34
|
+
@finder = Lyrics::Finder.new(:lyrics_wikia)
|
35
35
|
VCR.use_cassette 'LyricsWikia 200 search' do
|
36
36
|
@song = @finder.search("american authors", "best day of my life")
|
37
37
|
end
|
@@ -49,7 +49,7 @@ describe Finder do
|
|
49
49
|
# Searching for a song that exist but it's not yet on this website.
|
50
50
|
context 'with a song that cannot be found' do
|
51
51
|
before :each do
|
52
|
-
@finder = Finder.new(:lyrics_wikia)
|
52
|
+
@finder = Lyrics::Finder.new(:lyrics_wikia)
|
53
53
|
VCR.use_cassette 'LyricsWikia Song does not exist search' do
|
54
54
|
@song = @finder.search("arctic monkeys", "do i wanna know")
|
55
55
|
end
|
@@ -63,7 +63,7 @@ describe Finder do
|
|
63
63
|
|
64
64
|
describe 'using Azlyrics as the provider' do
|
65
65
|
before :each do
|
66
|
-
@finder = Finder.new(:azlyrics)
|
66
|
+
@finder = Lyrics::Finder.new(:azlyrics)
|
67
67
|
VCR.use_cassette 'Azlyrics 200 search' do
|
68
68
|
@song = @finder.search("american authors", "best day of my life")
|
69
69
|
end
|
@@ -80,7 +80,7 @@ describe Finder do
|
|
80
80
|
|
81
81
|
describe 'using SongLyrics as the provider' do
|
82
82
|
before :each do
|
83
|
-
@finder = Finder.new(:song_lyrics)
|
83
|
+
@finder = Lyrics::Finder.new(:song_lyrics)
|
84
84
|
VCR.use_cassette 'SongLyrics 200 search' do
|
85
85
|
@song = @finder.search("american authors", "best day of my life")
|
86
86
|
end
|
@@ -99,7 +99,7 @@ describe Finder do
|
|
99
99
|
# it just redirect to the root url www.lyricsmania.com
|
100
100
|
# describe 'using LyricsMania as the provider' do
|
101
101
|
# before :each do
|
102
|
-
# @finder = Finder.new(:lyrics_mania)
|
102
|
+
# @finder = Lyrics::Finder.new(:lyrics_mania)
|
103
103
|
# VCR.use_cassette 'LyricsMania 200 search' do
|
104
104
|
# @song = @finder.search("american authors", "best day of my life")
|
105
105
|
# end
|
@@ -116,7 +116,7 @@ describe Finder do
|
|
116
116
|
|
117
117
|
describe 'with a song that cannot be found' do
|
118
118
|
before :each do
|
119
|
-
@finder = Finder.new
|
119
|
+
@finder = Lyrics::Finder.new
|
120
120
|
VCR.use_cassette 'Nonexistent Song 404 search' do
|
121
121
|
@song = @finder.search("the foobar band", "rubynation")
|
122
122
|
end
|
@@ -128,7 +128,7 @@ describe Finder do
|
|
128
128
|
end
|
129
129
|
|
130
130
|
describe 'with invalid parameters' do
|
131
|
-
let(:finder) { Finder.new }
|
131
|
+
let(:finder) { Lyrics::Finder.new }
|
132
132
|
|
133
133
|
it 'fails with ContractError' do
|
134
134
|
expect{
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
describe Providers::Azlyrics do
|
2
|
+
describe Lyrics::Providers::Azlyrics do
|
3
3
|
describe '.format_url' do
|
4
4
|
context 'with valid author and title' do
|
5
|
-
let(:klass) { Providers::Azlyrics }
|
6
|
-
let(:song) { Song.new("amêricàn authors", "best day of my life") }
|
5
|
+
let(:klass) { Lyrics::Providers::Azlyrics }
|
6
|
+
let(:song) { Lyrics::Song.new("amêricàn authors", "best day of my life") }
|
7
7
|
let(:valid_url) { "http://www.azlyrics.com/lyrics/americanauthors/bestdayofmylife.html" }
|
8
8
|
|
9
9
|
it 'returns a properly formatted url' do
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
describe Providers::LyricsWikia do
|
2
|
+
describe Lyrics::Providers::LyricsWikia do
|
3
3
|
describe '.format_url' do
|
4
4
|
context 'with valid author and title' do
|
5
|
-
let(:klass) { Providers::LyricsWikia }
|
6
|
-
let(:song) { Song.new("amëricán authòrs", "best day of my life") }
|
5
|
+
let(:klass) { Lyrics::Providers::LyricsWikia }
|
6
|
+
let(:song) { Lyrics::Song.new("amëricán authòrs", "best day of my life") }
|
7
7
|
let(:valid_url) { "http://lyrics.wikia.com/american_authors:best_day_of_my_life" }
|
8
8
|
|
9
9
|
it 'returns a properly formatted url' do
|
@@ -12,7 +12,7 @@ describe Providers::LyricsWikia do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'with invalid author or title' do
|
15
|
-
let(:klass) { Providers::LyricsWikia }
|
15
|
+
let(:klass) { Lyrics::Providers::LyricsWikia }
|
16
16
|
|
17
17
|
it 'with non-string arguments raises a ContractError Exception' do
|
18
18
|
expect{
|
@@ -31,7 +31,7 @@ describe Providers::LyricsWikia do
|
|
31
31
|
describe '.extract_lyric' do
|
32
32
|
# with valid data it's already tested in lyrics_finder_spec.rb
|
33
33
|
context 'with invalid data' do
|
34
|
-
let(:klass) { Providers::LyricsWikia }
|
34
|
+
let(:klass) { Lyrics::Providers::LyricsWikia }
|
35
35
|
|
36
36
|
it 'raises a ContractError Exception' do
|
37
37
|
expect{
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
describe Providers::SongLyrics do
|
2
|
+
describe Lyrics::Providers::SongLyrics do
|
3
3
|
describe '.format_url' do
|
4
4
|
context 'with valid author and title' do
|
5
|
-
let(:klass) { Providers::SongLyrics}
|
6
|
-
let(:song) { Song.new("amêricàn authors", "best day of my life") }
|
5
|
+
let(:klass) { Lyrics::Providers::SongLyrics}
|
6
|
+
let(:song) { Lyrics::Song.new("amêricàn authors", "best day of my life") }
|
7
7
|
let(:valid_url) { "http://www.songlyrics.com/american-authors/best-day-of-my-life-lyrics/" }
|
8
8
|
|
9
9
|
it 'returns a properly formatted url' do
|
@@ -1,17 +1,17 @@
|
|
1
|
-
describe Providers do
|
1
|
+
describe Lyrics::Providers do
|
2
2
|
describe '.build_klass' do
|
3
3
|
context 'with valid arguments' do
|
4
|
-
let(:klass) { Providers::LyricsWikia }
|
4
|
+
let(:klass) { Lyrics::Providers::LyricsWikia }
|
5
5
|
|
6
6
|
it 'builds the correct class' do
|
7
|
-
expect(Providers.build_klass(:lyrics_wikia)).to eq klass
|
7
|
+
expect(Lyrics::Providers.build_klass(:lyrics_wikia)).to eq klass
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
context 'with invalid arguments' do
|
12
12
|
it 'raises a ContractError Exception' do
|
13
13
|
expect{
|
14
|
-
Providers.build_klass("klass")
|
14
|
+
Lyrics::Providers.build_klass("klass")
|
15
15
|
}.to raise_error ContractError
|
16
16
|
end
|
17
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lyrics_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Romero
|
@@ -216,11 +216,6 @@ files:
|
|
216
216
|
- spec/support/lyrics_wikia_sample_songs.rb
|
217
217
|
- spec/support/song_lyrics_sample_songs.rb
|
218
218
|
- spec/support/vcr_setup.rb
|
219
|
-
- spec/vcr_cassettes/Azlyrics_200_search.yml
|
220
|
-
- spec/vcr_cassettes/LyricsWikia_200_search.yml
|
221
|
-
- spec/vcr_cassettes/LyricsWikia_Song_does_not_exist_search.yml
|
222
|
-
- spec/vcr_cassettes/Nonexistent_Song_404_search.yml
|
223
|
-
- spec/vcr_cassettes/SongLyrics_200_search.yml
|
224
219
|
homepage: https://github.com/dnlR/lyrics_finder
|
225
220
|
licenses:
|
226
221
|
- MIT
|
@@ -256,8 +251,3 @@ test_files:
|
|
256
251
|
- spec/support/lyrics_wikia_sample_songs.rb
|
257
252
|
- spec/support/song_lyrics_sample_songs.rb
|
258
253
|
- spec/support/vcr_setup.rb
|
259
|
-
- spec/vcr_cassettes/Azlyrics_200_search.yml
|
260
|
-
- spec/vcr_cassettes/LyricsWikia_200_search.yml
|
261
|
-
- spec/vcr_cassettes/LyricsWikia_Song_does_not_exist_search.yml
|
262
|
-
- spec/vcr_cassettes/Nonexistent_Song_404_search.yml
|
263
|
-
- spec/vcr_cassettes/SongLyrics_200_search.yml
|