Sha256: 1731aec88156221eda31896263b19e24bbe8c1adb03f495a3884202bff0bd2e1

Contents?: true

Size: 998 Bytes

Versions: 3

Compression:

Stored size: 998 Bytes

Contents

require "spec_helper"

describe SocialAvatarProxy::TwitterAvatar do
  subject do
    SocialAvatarProxy::TwitterAvatar.new(id)
  end

  context "with a valid user ID" do
    let(:id) { "2202971" }

    describe "#remote_url" do
      it "should return a valid URL" do
        expected = "http://api.twitter.com/1/users/profile_image?user_id=#{id}&size=original"
        expect(subject.remote_url).to eq(expected)
      end
    end
  end

  context "with a valid user name" do
    let(:id) { "RyanTownsend" }
  
    describe "#remote_url" do
      it "should return a valid URL" do
        expected = "http://api.twitter.com/1/users/profile_image?screen_name=#{id}&size=original"
        expect(subject.remote_url).to eq(expected)
      end
    end
  end
    
  context "with an invalid identifier" do
    let(:id) { "$omeInvalidN@me" }
  
    describe "#remote_url" do
      it "should raise an error" do
        expect { subject.remote_url }.to raise_error(RuntimeError)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
social-avatar-proxy-0.0.3 spec/social_avatar_proxy/twitter_avatar_spec.rb
social-avatar-proxy-0.0.2 spec/social_avatar_proxy/twitter_avatar_spec.rb
social-avatar-proxy-0.0.1 spec/social_avatar_proxy/twitter_avatar_spec.rb