Sha256: 30280826de8482416b1480354689b1c8403e01f8c3a4b05b3afc9a12dd2a2ee9

Contents?: true

Size: 881 Bytes

Versions: 3

Compression:

Stored size: 881 Bytes

Contents

require File.expand_path('../../spec_helper', __FILE__)

describe OmniAuth::Builder do
  describe '#provider' do
    it 'should translate a symbol to a constant' do
      OmniAuth::Strategies.should_receive(:const_get).with('MyStrategy').and_return(Class.new)
      OmniAuth::Builder.new(nil) do
        provider :my_strategy
      end
    end

    it 'should also just accept a class' do
      class ::ExampleClass; end

      lambda{ OmniAuth::Builder.new(nil) do
        provider ::ExampleClass
      end }.should_not raise_error
    end

    it "should raise a helpful LoadError messgae if it can't find the class" do
      expect {
        OmniAuth::Builder.new(nil) do
          provider :lorax
        end
      }.to raise_error(LoadError, "Could not find matching strategy for :lorax. You may need to install an additional gem (such as omniauth-lorax).")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
omniauth-1.0.3 spec/omniauth/builder_spec.rb
omniauth-1.0.2 spec/omniauth/builder_spec.rb
omniauth-1.0.1 spec/omniauth/builder_spec.rb