Sha256: 96278910773d46d82b514a1ab6a2db7396916fc953b2241a2e85bfcd9d65a01b

Contents?: true

Size: 756 Bytes

Versions: 2

Compression:

Stored size: 756 Bytes

Contents

require 'spec_helper'
require 'active_support/core_ext/object/blank'
require 'doorkeeper/models/revocable'

describe 'Revocable' do
  subject do
    Class.new do
      include Doorkeeper::Models::Revocable
    end.new
  end

  describe :revoke do
    it "updates :revoked_at attribute with current time" do
      clock = double :now => double
      subject.should_receive(:update_column).with(:revoked_at, clock.now)
      subject.revoke(clock)
    end
  end

  describe :revoked? do
    it "is revoked if :revoked_at is set" do
      subject.stub :revoked_at => double
      subject.should be_revoked
    end

    it "is not revoked if :revoked_at is not set" do
      subject.stub :revoked_at => nil
      subject.should_not be_revoked
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
doorkeeper-1.0.0.rc2 spec/lib/models/revocable_spec.rb
doorkeeper-1.0.0.rc1 spec/lib/models/revocable_spec.rb