Sha256: ae745d0c3d5ea992727077c4c11283fb790b9481e389969f79bed7bfa61999af

Contents?: true

Size: 792 Bytes

Versions: 4

Compression:

Stored size: 792 Bytes

Contents

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

4 entries across 4 versions & 1 rubygems

Version Path
apress-api-1.24.0 spec/models/client_spec.rb
apress-api-1.23.0 spec/models/client_spec.rb
apress-api-1.22.1 spec/models/client_spec.rb
apress-api-1.22.0 spec/models/client_spec.rb