Skip to content

Commit

Permalink
Fixed automated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
serv committed Dec 21, 2017
1 parent d36a792 commit 7998b79
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 2 additions & 0 deletions lib/napster/models/track.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion napster.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 4 additions & 4 deletions spec/lib/napster/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions spec/lib/napster/response_error_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7998b79

Please sign in to comment.