Sha256: 8d3f604f2573448505684c2f4372bfe4ce2a62b4ab702f7cb9e07cb82b5cfa03

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require "rails_helper_for_engine"

RSpec.describe Omniauth::Rails::Configurator do
  let(:required_data) do
    {
      "unauthenticated_root" => "/",
      "authenticated_root" => "/",
      "providers" => {
        "google_oauth2" => {
          "client_id" => 1,
          "client_secret" => 1,
        },
      },
    }
  end

  let(:data) { required_data }
  let(:configurator) { Omniauth::Rails::Configurator.new(data) }

  describe "#configure" do
    context "dev_mode is true" do
      let(:data) { required_data.merge("dev_mode" => true) }

      context "dev_mode is allowed" do
        around(:each) do |example|
          path_prefix = OmniAuth.config.path_prefix
          example.run
          # Put it back to the initial value
          Omniauth::Rails::Configuration.dev_mode = false
          OmniAuth.config.path_prefix = path_prefix
        end

        it "sets Configuration.dev_mode = true" do
          expect(configurator).to receive(:configure_providers)
          expect(::Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("development"))

          configurator.configure
          expect(Omniauth::Rails::Configuration.dev_mode).to eq(true)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
omniauth-rails-0.6.0 spec/lib/omniauth/rails/configurator_spec.rb
omniauth-rails-0.5.0 spec/lib/omniauth/rails/configurator_spec.rb
omniauth-rails-0.4.0 spec/lib/omniauth/rails/configurator_spec.rb
omniauth-rails-0.3.0 spec/lib/omniauth/rails/configurator_spec.rb
omniauth-rails-0.2.0 spec/lib/omniauth/rails/configurator_spec.rb