Sha256: b855ed59e21240e6cb278f40ab2f9d9e18bac52a72a2c32360a8e81b836722d1

Contents?: true

Size: 1.2 KB

Versions: 4

Compression:

Stored size: 1.2 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "User with oauth submodule" do

  # ----------------- PLUGIN CONFIGURATION -----------------------
  describe User, "loaded plugin configuration" do
  
    before(:all) do
      User.delete_all
      Authentication.delete_all
      sorcery_reload!([:external])
      sorcery_controller_property_set(:external_providers, [:twitter])
      sorcery_model_property_set(:authentications_class, Authentication)
      sorcery_controller_external_property_set(:twitter, :key, "eYVNBjBDi33aa9GkA3w")
      sorcery_controller_external_property_set(:twitter, :secret, "XpbeSdCoaKSmQGSeokz5qcUATClRW5u08QWNfv71N8")
      sorcery_controller_external_property_set(:twitter, :callback_url, "http://blabla.com")
      create_new_external_user(:twitter)
    end

    it "should respond to 'load_from_provider'" do
      User.should respond_to(:load_from_provider)
    end
    
    it "'load_from_provider' should load user if exists" do
      User.load_from_provider(:twitter,123).should == @user
    end
    
    it "'load_from_provider' should return nil if user doesn't exist" do
      User.load_from_provider(:twitter,980342).should be_nil
    end
    
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sorcery-0.5.21 spec/rails3_mongoid/spec/user_oauth_spec.rb
sorcery-0.5.2 spec/rails3_mongoid/spec/user_oauth_spec.rb
sorcery-0.5.1 spec/rails3_mongoid/spec/user_oauth_spec.rb
sorcery-0.5.0 spec/rails3_mongoid/spec/user_oauth_spec.rb