Sha256: 6625ed274d9a427ca8cbf6e2ed9b3d6a5a17e224df9c980192ad7701318e375f

Contents?: true

Size: 822 Bytes

Versions: 1

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

describe Apress::Api::Client do
  let(:client) { create "api/client" }

  describe "#regenerate_tokens" do
    it "regenerates secret and refresh tokens" do
      client.regenerate_tokens

      expect(client.changed).
        to match_array %w(secret_token secret_token_expire_at refresh_token refresh_token_expire_at)
    end
  end

  describe "#regenerate_tokens!" do
    it "regenerates secret and refresh tokens and save" do
      attrs_names = %w(secret_token secret_token_expire_at refresh_token refresh_token_expire_at)
      was_attrs = client.attributes.slice(*attrs_names).values
      client.regenerate_tokens!

      expect(client.attributes.slice(*attrs_names).values).to_not include(was_attrs)
      expect(client.changed?).to be false
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
apress-api-1.24.2 spec/models/client_spec.rb