You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
885 B
Ruby
45 lines
885 B
Ruby
13 years ago
|
require 'spec_helper'
|
||
|
|
||
|
describe OauthHelper do
|
||
|
describe ".avatar_url" do
|
||
|
let(:avatar_url) { "http://foo.bar/foo.png" }
|
||
|
|
||
|
context "when github auth" do
|
||
|
let(:auth) do
|
||
|
{
|
||
|
"provider" => "github",
|
||
13 years ago
|
"extra" => {
|
||
13 years ago
|
"raw_info" => {
|
||
13 years ago
|
"avatar_url" => avatar_url
|
||
|
}
|
||
13 years ago
|
}
|
||
|
}
|
||
|
end
|
||
|
|
||
13 years ago
|
it { OauthHelper.get_avatar_url(auth).should == avatar_url }
|
||
13 years ago
|
|
||
|
end
|
||
|
|
||
|
context "when twitter auth" do
|
||
|
let(:auth) do
|
||
|
{
|
||
|
"provider" => "twitter",
|
||
|
"info" => {
|
||
|
"image" => avatar_url
|
||
|
}
|
||
|
}
|
||
|
end
|
||
|
|
||
13 years ago
|
it { OauthHelper.get_avatar_url(auth).should == avatar_url }
|
||
13 years ago
|
end
|
||
|
|
||
|
context "when other provider" do
|
||
|
let(:auth) do
|
||
|
{ "provider" => "other" }
|
||
|
end
|
||
|
|
||
|
it { OauthHelper.get_avatar_url(auth).should be_nil }
|
||
|
end
|
||
|
end
|
||
|
end
|