spec/scraperwiki-api_spec.rb in scraperwiki-api-0.0.2 vs spec/scraperwiki-api_spec.rb in scraperwiki-api-0.0.3

- old
+ new

@@ -20,11 +20,11 @@ describe '#scraper_getinfo' do it 'should return a non-empty array containing a single hash' do response = @api.scraper_getinfo EXAMPLE_SHORTNAME response.should be_an(Array) - response.size.should == 1 + response.should have(1).item response.first.should be_a(Hash) end it 'should respect the :version argument' do bare = @api.scraper_getinfo(EXAMPLE_SHORTNAME).first @@ -34,14 +34,14 @@ result['code'].should_not == bare['code'] end it 'should respect the :history_start_date argument' do bare = @api.scraper_getinfo(EXAMPLE_SHORTNAME).first - bare['history'].size.should be > 1 + bare['history'].should have_at_least(2).items history_start_date = bare['history'][0]['date'][0..9] result = @api.scraper_getinfo(EXAMPLE_SHORTNAME, history_start_date: history_start_date).first - result['history'].size.should == 1 + result['history'].should have(1).item end it 'should respect the :quietfields argument (as an array)' do result = @api.scraper_getinfo(EXAMPLE_SHORTNAME, quietfields: QUIETFIELDS).first QUIETFIELDS.each do |key| @@ -59,11 +59,11 @@ describe '#scraper_getruninfo' do it 'should return a non-empty array containing a single hash' do response = @api.scraper_getruninfo EXAMPLE_SHORTNAME response.should be_an(Array) - response.size.should == 1 + response.should have(1).item response.first.should be_a(Hash) end it 'should respect the :runid argument' do runevents = @api.scraper_getinfo(EXAMPLE_SHORTNAME).first['runevents'] @@ -76,49 +76,49 @@ describe '#scraper_getuserinfo' do it 'should return a non-empty array containing a single hash' do response = @api.scraper_getuserinfo EXAMPLE_USERNAME response.should be_an(Array) - response.size.should == 1 + response.should have(1).item response.first.should be_a(Hash) end end describe '#scraper_search' do it 'should return a non-empty array of hashes' do response = @api.scraper_search response.should be_an(Array) - response.size.should_not be_zero + response.should have_at_least(1).item response.first.should be_a(Hash) end it 'should respect the :searchquery argument' do @api.scraper_search(searchquery: EXAMPLE_SHORTNAME).find{|result| result['short_name'] == EXAMPLE_SHORTNAME }.should_not be_nil end it 'should respect the :maxrows argument' do - @api.scraper_search(maxrows: 1).size.should == 1 + @api.scraper_search(maxrows: 1).should have(1).item end end describe '#scraper_usersearch' do it 'should return a non-empty array of hashes' do response = @api.scraper_usersearch response.should be_an(Array) - response.size.should_not be_zero + response.should have_at_least(1).item response.first.should be_a(Hash) end it 'should respect the :searchquery argument' do @api.scraper_usersearch(searchquery: EXAMPLE_USERNAME).find{|result| result['username'] == EXAMPLE_USERNAME }.should_not be_nil end it 'should respect the :maxrows argument' do - @api.scraper_usersearch(maxrows: 1).size.should == 1 + @api.scraper_usersearch(maxrows: 1).should have(1).item end it 'should respect the :nolist argument (as an array)' do usernames = @api.scraper_usersearch.map{|result| result['username']} @api.scraper_usersearch(nolist: usernames).find{|result|