Sha256: cb6e1b74af090097275d7de166d31b4ec6cd3bc3508aac4a89b6d5586dbf5e62

Contents?: true

Size: 848 Bytes

Versions: 7

Compression:

Stored size: 848 Bytes

Contents

require 'spec_helper'

describe Devise::Oauth::Client do
  before { @client = create(:client) }
  subject { @client }

  it { should validate_presence_of(:name) }
  it { should validate_presence_of(:site_uri) }

  it { should belong_to(:owner) }

  it { should have_many(:access_tokens) }
  it { should have_many(:authorizations) }

  it { should have_db_index(:identifier).unique(true) }
  it { should have_db_index(:secret).unique(true) }
  it { should have_db_index(:owner_id).unique(false) }

  its(:identifier) { should_not be_nil }
  its(:secret) { should_not be_nil }

  it { should_not be_blocked }

  it ".granted!" do
    lambda{ subject.granted! }.should change{ subject.reload; subject.granted_times }.by(1)
  end

  it ".revoked!" do
    lambda{ subject.revoked! }.should change{ subject.reload; subject.revoked_times }.by(1)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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