Sha256: cebd50b78d94282ea1cf01b0d24c37e5e573a6d3f9769bb9df5461752d67559d
Contents?: true
Size: 1.6 KB
Versions: 1
Compression:
Stored size: 1.6 KB
Contents
require File.dirname(__FILE__) + '/../test_helper' class ClientTest < Test::Unit::TestCase include Billboard context "Hitting the Billboard API" do setup { @client = Billboard::Client.new('OU812') } should "find chart data based on chart id" do stub_get 'http://api.billboard.com/apisvc/chart/v1/item?id=3064446&format=json&api_key=OU812', 'chart.json' chart = @client.chart(3064446) chart.description.should == 'Chart' chart.chart_items.items.size.should == 10 chart.chart_items.items.last.artist_name.should == 'Sade' end should "find chart data based on artist name and date range" do stub_get 'http://api.billboard.com/apisvc/chart/v1/list?end_date=1975-12-31&format=json&sdate=1975-01-01&artist=Waylon%20Jennings&sort=date%20&edate=1975-12-31&start_date=1975-01-01&api_key=OU812', 'artist_search_with_date_range.json' results = @client.search(:artist => 'Waylon Jennings', :start_date => '1975-01-01', :end_date => '1975-12-31', :sort => 'date+') results.total_records.should == 927 results.chart_items.size.should == 50 results.chart_items.last.song.should == "Sweet Dream Woman" results.chart_items.last.weeks_on.should == 13 end should "find album charts" do stub_get 'http://api.billboard.com/apisvc/chart/v1/list/spec?type=album&api_key=OU812&format=json', 'album_charts.json' results = @client.chart_specs(:type => 'album') results.total_records.should == 589 results.total_returned.should == 50 results.charts.last.name.should == 'Latin Rhythm Albums' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
billboard-0.1.0 | test/billboard/client_test.rb |