Sha256: d0c8c5488c32503f6bb2082a6d65a0785d5beea829fcb8f429650b244493daa6

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

require "spec_helper"

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

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

  describe ".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

  describe ".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

  describe ".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

2 entries across 2 versions & 1 rubygems

Version Path
discourse_api-2.0.1 spec/discourse_api/single_sign_on_spec.rb
discourse_api-2.0.0 spec/discourse_api/single_sign_on_spec.rb