Sha256: 4a91d515a252ef1fd4801e933f01b2a0fcab6024afec81216c2a5427d4e22270

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 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.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.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

3 entries across 3 versions & 1 rubygems

Version Path
pilha-0.1.5 spec/pilha/stack_overflow/badge_spec.rb
pilha-0.1.3 spec/pilha/stack_overflow/badge_spec.rb
pilha-0.1.2 spec/pilha/stack_overflow/badge_spec.rb