Sha256: 0d3c51353e695a52bc8cf3b4539afab47c6b29aad886ee706c51a52294309016

Contents?: true

Size: 1.77 KB

Versions: 10

Compression:

Stored size: 1.77 KB

Contents

require 'spec_helper'

class Account; end
class Authentication; end

class User; end
class Identity; end

describe Socialite do
  context "configuration" do
    it 'is configurable through .setup' do
      Socialite.setup do |c|
        c.should be_kind_of(Module)
      end
    end

    describe 'configuring classes' do

      describe 'the default values' do
        before do
          Socialite.setup do |c|
            c.user_class = nil
            c.identity_class = nil
          end
        end

        its(:user_class) { should eql(User) }
        its(:identity_class) { should eql(Identity) }
      end

      describe 'accessors that manipulate default values' do
        before do
          Socialite.setup do |c|
            c.user_class = 'Account'
            c.identity_class = 'Authentication'
          end
        end

        its(:user_class) { should eql(Account) }
        its(:identity_class) { should eql(Authentication) }

        after do
          Socialite.setup do |c|
            c.user_class = nil
            c.identity_class = nil
          end
        end
      end
    end

    describe 'accepting provider information' do
      before do
        Socialite.providers = nil
        Socialite.setup do |c|
          c.provider :facebook, 'xyz', '123'
          c.provider :twitter, 'abc', '789'
        end
      end

      subject { Socialite.providers }

      its(:size) { should == 2 }

      describe 'holds all the provider parameters for OmniAuth' do
        it 'has facebook data' do
          subject.first[0].should == :facebook
          subject.first[1].should == ['xyz', '123']
        end

        it 'has twitter data' do
          subject.last[0].should == :twitter
          subject.last[1].should == ['abc', '789']
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
socialite-0.2.1 spec/socialite_spec.rb
socialite-0.2.0 spec/socialite_spec.rb
socialite-0.1.2 spec/socialite_spec.rb
socialite-0.1.1 spec/socialite_spec.rb
socialite-0.1.0.pre.7 spec/socialite_spec.rb
socialite-0.1.0.pre.6 spec/socialite_spec.rb
socialite-0.1.0.pre.5 spec/socialite_spec.rb
socialite-0.1.0.pre.4 spec/socialite_spec.rb
socialite-0.1.0.pre.3 spec/socialite_spec.rb
socialite-0.1.0.pre.2 spec/socialite_spec.rb