Sha256: 287b48f609c66ee86f9b763c52d285728646c17c627dae1970615753a37ada79

Contents?: true

Size: 811 Bytes

Versions: 3

Compression:

Stored size: 811 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
      expect(subject).to 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
      allow(subject).to receive(:revoked_at).and_return(double)
      expect(subject).to be_revoked
    end

    it 'is not revoked if :revoked_at is not set' do
      allow(subject).to receive(:revoked_at).and_return(nil)
      expect(subject).not_to be_revoked
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-1.3.1 spec/lib/models/revocable_spec.rb
doorkeeper-1.3.0 spec/lib/models/revocable_spec.rb
doorkeeper-1.2.0 spec/lib/models/revocable_spec.rb