Sha256: 0fa1226278173a6fe3a7e09af288705352bf6346fb2c0d9818c887980abd3da6

Contents?: true

Size: 1.46 KB

Versions: 20

Compression:

Stored size: 1.46 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe '#radio' do
  before { init_lastfm }

  it 'should return an instance of Lastfm::Radio' do
    @lastfm.radio.should be_an_instance_of(Lastfm::MethodCategory::Radio)
  end

  describe '#tune' do
    it 'should tune' do
      @lastfm.should_receive(:request).with('radio.tune', {
        :station => 'lastfm://globaltags/pop',
      }, :post, true, true).and_return(@ok_response)
      @lastfm.radio.tune("lastfm://globaltags/pop")
    end
  end

  describe '#get_playlist' do
    it 'should return some playlist' do
      @lastfm.should_receive(:request).with("radio.getPlaylist", {}, :get, true, true).and_return(make_response('radio_get_playlist'))
      playlist = @lastfm.radio.get_playlist
      tracklist = playlist["trackList"]["track"]
      tracklist.should be_an_instance_of(Array)
      tracklist[0]['title'].should == "All The Things She Said"
      tracklist[1]['location'].should == "http://play.last.fm/user/bca46e434c3389217ef1b8d20db1690c.mp3"
      tracklist[2]['creator'].should == "Culture Club"
      tracklist[3]['album'].should == "The E.N.D."
    end

    it 'should always return playlists with arrays of tracks' do
      @lastfm.should_receive(:request).with("radio.getPlaylist", {}, :get, true, true).and_return(make_response('radio_get_playlist_single_track'))
      playlist = @lastfm.radio.get_playlist
      playlist["trackList"]["track"].should be_an_instance_of(Array)
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
lastfm-1.27.3 spec/method_specs/radio_spec.rb
lastfm-1.27.2 spec/method_specs/radio_spec.rb
lastfm-1.27.1 spec/method_specs/radio_spec.rb
lastfm-1.27.0 spec/method_specs/radio_spec.rb
lastfm-1.26.0 spec/method_specs/radio_spec.rb
lastfm-1.25.0 spec/method_specs/radio_spec.rb
lastfm-1.24.0 spec/method_specs/radio_spec.rb
lastfm-1.23.0 spec/method_specs/radio_spec.rb
lastfm-1.22.0 spec/method_specs/radio_spec.rb
lastfm-1.21.0 spec/method_specs/radio_spec.rb
lastfm-1.20.1 spec/method_specs/radio_spec.rb
lastfm-1.19.1 spec/method_specs/radio_spec.rb
lastfm-1.19.0 spec/method_specs/radio_spec.rb
lastfm-1.18.0 spec/method_specs/radio_spec.rb
lastfm-1.17.0 spec/method_specs/radio_spec.rb
lastfm-1.16.0 spec/method_specs/radio_spec.rb
lastfm-1.15.1 spec/method_specs/radio_spec.rb
lastfm-1.15.0 spec/method_specs/radio_spec.rb
lastfm-1.14.1 spec/method_specs/radio_spec.rb
lastfm-1.14.0 spec/method_specs/radio_spec.rb