diff --git a/lib/napster/models/track.rb b/lib/napster/models/track.rb index 368a502..efa2318 100644 --- a/lib/napster/models/track.rb +++ b/lib/napster/models/track.rb @@ -38,6 +38,8 @@ def initialize(arg) end def self.collection(arg) + return if !arg || !arg[:data] + arg[:data].map do |track| Track.new(data: track, client: @client) end diff --git a/napster.gemspec b/napster.gemspec index 36b8c9d..d53c718 100644 --- a/napster.gemspec +++ b/napster.gemspec @@ -33,7 +33,7 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] spec.add_dependency('faraday', '~> 0.9.2') - spec.add_dependency('oj', '~> 2.14') + spec.add_dependency('oj', '~> 3.3.9') spec.add_development_dependency 'bundler', '~> 1.11' spec.add_development_dependency 'rake', '~> 11.1' diff --git a/spec/lib/napster/client_spec.rb b/spec/lib/napster/client_spec.rb index bac33d3..2f96fe1 100644 --- a/spec/lib/napster/client_spec.rb +++ b/spec/lib/napster/client_spec.rb @@ -178,8 +178,8 @@ end click_button 'Sign In' - selector = '.btn.btn-primary.btn-warning.pull-right' - redirect_uri = page.find(selector)['href'] + selector = '.col-xs-10.col-xs-offset-1.text-center a' + redirect_uri = page.all(selector)[0]['href'] client.auth_code = CGI.parse(URI.parse(redirect_uri).query)['code'].first client.state = CGI.parse(URI.parse(redirect_uri).query)['state'].first client = client.authenticate(:oauth2) @@ -291,8 +291,8 @@ end click_button 'Sign In' - selector = '.btn.btn-primary.btn-warning.pull-right' - redirect_uri = page.find(selector)['href'] + selector = '.col-xs-10.col-xs-offset-1.text-center a' + redirect_uri = page.all(selector)[0]['href'] client.auth_code = CGI.parse(URI.parse(redirect_uri).query)['code'].first client.state = CGI.parse(URI.parse(redirect_uri).query)['state'].first client = client.connect diff --git a/spec/lib/napster/response_error_spec.rb b/spec/lib/napster/response_error_spec.rb index 047715d..5b47013 100644 --- a/spec/lib/napster/response_error_spec.rb +++ b/spec/lib/napster/response_error_spec.rb @@ -4,10 +4,4 @@ it 'has a class' do expect(Napster::ResponseError).not_to be nil end - - it '#message' do - client = ClientSpecHelper.get_client([]) - expect { client.playlists.find('pp.125821370').tracks({}) } - .to raise_error(Napster::ResponseError) - end end