Sha256: 5b776cfc4f120cf12365ea745c252edf3004fb1f7df662ab8f24c549d84535d7

Contents?: true

Size: 667 Bytes

Versions: 3

Compression:

Stored size: 667 Bytes

Contents

require 'spec_helper'

module Oa2c
  class Token
    include Mongoid::Document
    include OAuth2Token
  end

  describe OAuth2Token do
    subject { Token }

    its(:default_lifetime) { should == 15.minutes }

    context "on create" do
      subject { Token.new }
      it "should generate token" do
        subject.token.should be_blank
        subject.save
        subject.token.should_not be_blank
      end

      it "should set expiring date to default lifetime" do
        Timecop.freeze do
          subject.expires_at.should be_blank
          subject.save
          subject.expires_at.should == 15.minutes.from_now
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oa2c-0.1.1 spec/models/oa2c/oauth2_token_spec.rb
oa2c-0.1.0 spec/models/oa2c/oauth2_token_spec.rb
oa2c-0.0.2 spec/models/oa2c/oauth2_token_spec.rb