Sha256: 1802490ba6e1b2c11f864bd024dea69f084186d341015566f1c1cf7b60d7c5c9

Contents?: true

Size: 1.13 KB

Versions: 22

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require "spec_helper"

describe ::Doorkeeper::SecretStoring::Plain do
  subject { described_class }
  let(:instance) { double("instance", token: "foo") }

  describe "#transform_secret" do
    it "raises" do
      expect(subject.transform_secret("foo")).to eq "foo"
    end
  end

  describe "#restore_secret" do
    it "raises" do
      expect(subject.restore_secret(instance, :token)).to eq "foo"
    end
  end

  describe "#allows_restoring_secrets?" do
    it "does allow it" do
      expect(subject.allows_restoring_secrets?).to eq true
    end
  end

  describe "validate_for" do
    it "allows for valid model" do
      expect(subject.validate_for(:application)).to eq true
      expect(subject.validate_for(:token)).to eq true
    end

    it "raises for invalid model" do
      expect { subject.validate_for(:wat) }.to raise_error(ArgumentError, /can not be used for wat/)
    end
  end

  describe "secret_matches?" do
    it "compares input with #transform_secret" do
      expect(subject.secret_matches?("input", "input")).to eq true
      expect(subject.secret_matches?("a", "b")).to eq false
    end
  end
end

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
doorkeeper-5.1.2 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.2.6 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.3.3 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.1.1 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.2.5 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.3.2 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.4.0.rc1 spec/lib/secret_storing/plain_spec.rb
doorkeeper-mongodb-5.2.1 spec/lib/secret_storing/plain_spec.rb
doorkeeper-mongodb-5.2.0 spec/lib/secret_storing/plain_spec.rb
doorkeeper-sequel-2.2.0 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.2.4 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.3.1 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.3.0 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.2.3 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.2.2 spec/lib/secret_storing/plain_spec.rb
doorkeeper-sequel-2.1.0 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.2.1 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.2.0 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.2.0.rc3 spec/lib/secret_storing/plain_spec.rb
doorkeeper-5.2.0.rc2 spec/lib/secret_storing/plain_spec.rb