asciinema.org/spec/lib/oauth_helper_spec.rb

45 lines
885 B
Ruby
Raw Normal View History

2012-02-26 16:45:38 +00:00
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",
2012-03-02 21:33:37 +00:00
"extra" => {
2012-03-02 21:36:26 +00:00
"raw_info" => {
2012-03-02 21:33:37 +00:00
"avatar_url" => avatar_url
}
2012-02-26 16:45:38 +00:00
}
}
end
2012-03-08 14:00:00 +00:00
it { OauthHelper.get_avatar_url(auth).should == avatar_url }
2012-02-26 16:45:38 +00:00
end
context "when twitter auth" do
let(:auth) do
{
"provider" => "twitter",
"info" => {
"image" => avatar_url
}
}
end
2012-03-08 14:00:00 +00:00
it { OauthHelper.get_avatar_url(auth).should == avatar_url }
2012-02-26 16:45:38 +00:00
end
context "when other provider" do
let(:auth) do
{ "provider" => "other" }
end
it { OauthHelper.get_avatar_url(auth).should be_nil }
end
end
end