|
Revision 35296, 1.4 kB
(checked in by machu, 4 years ago)
|
|
write RSpec for profile.rb
|
| Line | |
|---|
| 1 | $:.unshift(File.dirname(__FILE__)) |
|---|
| 2 | require 'spec_helper' |
|---|
| 3 | require 'profile' |
|---|
| 4 | |
|---|
| 5 | describe "Profile::Service" do |
|---|
| 6 | |
|---|
| 7 | describe "GitHub" do |
|---|
| 8 | before :all do |
|---|
| 9 | # http://develop.github.com/p/general.html |
|---|
| 10 | @profile = Profile::Service::GitHub.new("schacon") |
|---|
| 11 | end |
|---|
| 12 | |
|---|
| 13 | it "should include name, mail, image properties" do |
|---|
| 14 | @profile.name.should == "Scott Chacon" |
|---|
| 15 | @profile.mail.should == "schacon@gmail.com" |
|---|
| 16 | @profile.image.should == "http://www.gravatar.com/avatar/9375a9529679f1b42b567a640d775e7d.jpg" |
|---|
| 17 | end |
|---|
| 18 | end |
|---|
| 19 | |
|---|
| 20 | describe "Twitter" do |
|---|
| 21 | before :all do |
|---|
| 22 | # http://twitter.com/tdiary |
|---|
| 23 | @profile = Profile::Service::Twitter.new("tdiary") |
|---|
| 24 | end |
|---|
| 25 | |
|---|
| 26 | it "should include name, description, image properties" do |
|---|
| 27 | @profile.name.should == "tDiary.org" |
|---|
| 28 | @profile.description.should == "tDiaryオフィシャルアカウント" |
|---|
| 29 | @profile.image.should match(%r{^http://.*\.(png|jpg)$}) |
|---|
| 30 | end |
|---|
| 31 | end |
|---|
| 32 | |
|---|
| 33 | describe "FriendFeed" do |
|---|
| 34 | before :all do |
|---|
| 35 | # http://friendfeed.com/api/documentation#summary |
|---|
| 36 | @profile = Profile::Service::FriendFeed.new("bret") |
|---|
| 37 | end |
|---|
| 38 | |
|---|
| 39 | it "should include name, description, image properties" do |
|---|
| 40 | @profile.name.should == "Bret Taylor" |
|---|
| 41 | @profile.description.should == "Co-founder of FriendFeed, programmer, food lover" |
|---|
| 42 | @profile.image.should == "http://friendfeed-api.com/v2/picture/bret" |
|---|
| 43 | end |
|---|
| 44 | end |
|---|
| 45 | |
|---|
| 46 | end |
|---|