Fixing tests

This commit is contained in:
Gregory Eremin
2012-09-06 11:09:58 +04:00
parent b9e90da8a3
commit 4976785e1c
3 changed files with 13 additions and 14 deletions
+3 -4
View File
@@ -39,14 +39,13 @@ module MusicBrainz
end
def search(name)
artists = load({
load({
:parser => :artist_search
}, {
:resource => :artist,
:query => CGI.escape(name).gsub(/\!/, '\!') + '~',
:limit => 50
:query => "artist:" << CGI.escape(name).gsub(/\!/, '\!'),
:limit => 10
})
artists.sort{ |a, b| b[:weight] <=> a[:weight] }.take(10)
end
def discography(mbid)
+3 -5
View File
@@ -21,19 +21,17 @@ module MusicBrainz
end
def search(xml)
artists = []
xml.css("artist-list > artist").each do |a|
artists << {
xml.css("artist-list > artist").map do |a|
{
:name => a.first_element_child.text.gsub(/[`]/, "'"),
:sort_name => safe_get_value(a, "sort-name").gsub(/[`]/, "'"),
:score => (safe_get_attr(a, nil, "score") .to_i rescue 0),
:score => (safe_get_attr(a, nil, "score").to_i rescue 0),
:desc => safe_get_value(a, "disambiguation"),
:type => safe_get_attr(a, nil, "type"),
:mbid => safe_get_attr(a, nil, "id"),
:aliases => a.css("alias-list > alias").map { |item| item.text }
}
end
artists
end
def release_groups(xml)