Sha256: e6b27b90970e02c51fa4e82dfb97e810ceedc36e38733f772d87b52d6dae7514

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe DiscourseApi::SingleSignOn do
  context "::MissingConfigError" do
    it "inherits from RuntimeError for backward compatibility" do
      expect(DiscourseApi::SingleSignOn::MissingConfigError).to be < RuntimeError
    end
  end

  context "::ParseError" do
    it "inherits from RuntimeError for backward compatibility" do
      expect(DiscourseApi::SingleSignOn::ParseError).to be < RuntimeError
    end
  end

  context ".sso_secret" do
    it "raises MissingConfigError when sso_secret is not present" do
      expect {
        described_class.sso_secret
      }.to raise_error(DiscourseApi::SingleSignOn::MissingConfigError)
    end
  end

  context ".sso_url" do
    it "raises MissingConfigError when sso_url is not present" do
      expect {
        described_class.sso_url
      }.to raise_error(DiscourseApi::SingleSignOn::MissingConfigError)
    end
  end

  context ".parse" do
    it "raises ParseError when there's a signature mismatch" do
      sso = described_class.new
      sso.sso_secret = "abcd"
      expect {
        described_class.parse(sso.payload, "dcba")
      }.to raise_error(DiscourseApi::SingleSignOn::ParseError)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
discourse_api-1.1.0 spec/discourse_api/single_sign_on_spec.rb