Sha256: bf0bb8c5e41af97559a6a94be20fe8acfdc373fef8f09142cdb4c44e5fb862ea

Contents?: true

Size: 1.32 KB

Versions: 3

Compression:

Stored size: 1.32 KB

Contents

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

describe "User with oauth submodule" do
  before(:all) do
    ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate/oauth")
  end
  
  after(:all) do
    ActiveRecord::Migrator.rollback("#{Rails.root}/db/migrate/oauth")
  end

  # ----------------- PLUGIN CONFIGURATION -----------------------
  describe User, "loaded plugin configuration" do
  
    before(:all) do
      sorcery_reload!([:oauth])
      sorcery_controller_property_set(:oauth_providers, [:twitter])
      sorcery_model_property_set(:authentications_class, Authentication)
      sorcery_controller_oauth_property_set(:twitter, :key, "eYVNBjBDi33aa9GkA3w")
      sorcery_controller_oauth_property_set(:twitter, :secret, "XpbeSdCoaKSmQGSeokz5qcUATClRW5u08QWNfv71N8")
      sorcery_controller_oauth_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

3 entries across 3 versions & 1 rubygems

Version Path
sorcery-0.3.0 spec/rails3/app_root/spec/user_oauth_spec.rb
sorcery-0.2.1 spec/rails3/app_root/spec/user_oauth_spec.rb
sorcery-0.2.0 spec/rails3/app_root/spec/user_oauth_spec.rb