asciinema.org/spec/lib/oauth_helper_spec.rb
2012-03-08 15:00:00 +01:00

45 lines
885 B
Ruby

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",
"extra" => {
"raw_info" => {
"avatar_url" => avatar_url
}
}
}
end
it { OauthHelper.get_avatar_url(auth).should == avatar_url }
end
context "when twitter auth" do
let(:auth) do
{
"provider" => "twitter",
"info" => {
"image" => avatar_url
}
}
end
it { OauthHelper.get_avatar_url(auth).should == avatar_url }
end
context "when other provider" do
let(:auth) do
{ "provider" => "other" }
end
it { OauthHelper.get_avatar_url(auth).should be_nil }
end
end
end