Sha256: b7a5da49d3ec6fc8b6587dc1c97230ef411c555816edc14494b5216c2a6a6401

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

describe StackExchange::StackOverflow::Badge do

  before do
    StackExchange::StackOverflow::Client.config
  end

  describe 'when querying for badges' do
    it 'should return all badges' do
      response = StackOverflow::Badge.all

      first_badge = response.badges.first
      first_badge.badge_id.should == 9
      first_badge.id.should == 9
      first_badge.rank.should == "bronze"
      first_badge.name.should == "Autobiographer"
      first_badge.description.should == "Completed all user profile fields"
      first_badge.award_count.should == 28065
      first_badge.tag_based.should be_false
      first_badge.badges_recipients_url.should == "/badges/9"
    end

    it 'should return all tag-based badges' do
      response = StackOverflow::Badge.all(:tag_based => true)
      first_tag_based = response.badges.first
      first_tag_based.id.should == 204
      first_tag_based.rank.should == "silver"
      first_tag_based.name.should == ".htaccess"
      first_tag_based.description.should == "Earned 400 upvotes for answers in the .htaccess tag"
      first_tag_based.award_count.should == 1
      first_tag_based.tag_based.should be_true
      first_tag_based.badges_recipients_url.should == "/badges/204"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pilha-0.1.6 spec/pilha/stack_overflow/badge_spec.rb