Sha256: b872ea38a553ee69d6125f9869c279a0eba7d8bbddb0036941c500275df2b726

Contents?: true

Size: 729 Bytes

Versions: 7

Compression:

Stored size: 729 Bytes

Contents

require 'spec_helper'

describe Devise::Oauth::AccessToken do
  before  { @token = create(:access_token) }
  subject { @token }

  it { should validate_presence_of(:client_id) }
  it { should validate_presence_of(:resource_owner_id) }

  it { should belong_to(:client) }
  it { should belong_to(:resource_owner) }

  it { should have_db_index(:value).unique(true) }
  it { should have_db_index(:refresh_token).unique(true) }
  it { should have_db_index(:client_id).unique(false) }

  its(:value) { should_not be_nil }
  its(:refresh_token) { should_not be_nil }
  its(:expires_at) { should_not be_nil }
  it { should_not be_blocked }

  it "refreshes value" do
    expect{ subject.refresh! }.to change { subject.value }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
devise_oauth-3.0.3 spec/models/oauth/access_token_spec.rb
devise_oauth-3.0.2 spec/models/oauth/access_token_spec.rb
devise_oauth-3.0.1 spec/models/oauth/access_token_spec.rb
devise_oauth-3.0.0 spec/models/oauth/access_token_spec.rb
devise_oauth-2.0.3 spec/models/oauth/access_token_spec.rb
devise_oauth-2.0.2 spec/models/oauth/access_token_spec.rb
devise_oauth-2.0.1 spec/models/oauth/access_token_spec.rb