Sha256: 07eaf251e702848fa1484a58189b99969bc56353572ea5e7c703de2b114b7db6
Contents?: true
Size: 1.07 KB
Versions: 6
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' require 'timecop' require 'active_support/time' require 'doorkeeper/models/expirable' describe 'Expirable' do subject do Class.new do include Doorkeeper::Models::Expirable end.new end before do subject.stub :created_at => 1.minute.ago end describe :expired? do it "is not expired if time has not passed" do subject.stub :expires_in => 2.minutes subject.should_not be_expired end it "is expired if time has passed" do subject.stub :expires_in => 10.seconds subject.should be_expired end it "is not expired if expires_in is not set" do subject.stub :expires_in => nil subject.should_not be_expired end end describe :expires_in_seconds do it "should return the amount of time remaining until the token is expired" do subject.stub :expires_in => 2.minutes subject.expires_in_seconds.should == 60 end it "should return 0 when expired" do subject.stub :expires_in => 30.seconds subject.expires_in_seconds.should == 0 end end end
Version data entries
6 entries across 6 versions & 1 rubygems