Sha256: 7e3b14b745c4a99249429fd26f0c7e5a5a2f2635ae281c6ff4dbd86cdeb070ed
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
require 'spec_helper' class FakeController def session @session ||= {} end include Warden::GitHub::SSO end describe Warden::GitHub::SSO do let(:default_attrs) do { 'login' => 'john', 'name' => 'John Doe', 'gravatar_id' => '38581cb351a52002548f40f8066cfecg', 'avatar_url' => 'http://example.com/avatar.jpg', 'email' => 'john@doe.com', 'company' => 'Doe, Inc.' } end let(:user) do Warden::GitHub::User.new(default_attrs, "the_token", "abcdefghijklmnop") end subject do FakeController.new end describe "warden_github_sso_session_valid?" do it "identifies when browsers need to be reverified" do subject.session[:warden_github_sso_session_verified_at] = Time.now.utc.to_i - 10 expect(subject).to be_warden_github_sso_session_valid(user) subject.session[:warden_github_sso_session_verified_at] = Time.now.utc.to_i - 300 stub_user_session_request.to_return(status: 204, body: "", headers: {}) expect(subject).to be_warden_github_sso_session_valid(user) subject.session[:warden_github_sso_session_verified_at] = Time.now.utc.to_i - 300 stub_user_session_request.to_return(status: 404, body: "", headers: {}) expect(subject).not_to be_warden_github_sso_session_valid(user) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
warden-github-1.3.2 | spec/unit/sso_spec.rb |