Sha256: 22019ed2499acb4791bd4afa3bd7c8ea3d253bb4bfc1cbe28cdcca3c2202158c

Contents?: true

Size: 1.72 KB

Versions: 8

Compression:

Stored size: 1.72 KB

Contents

require 'rubygems'
require 'active_record'
require 'active_resource'

require 'pp'
require File.dirname(__FILE__) + '/../lib/active_record/connection_adapters/activesalesforce_adapter'
require File.dirname(__FILE__) + '/recorded_test_case'


module Salesforce
  class SfBase < ActiveRecord::Base
    self.logger

    #takes parameter from the config_file
    def self.login(user, pass, token)
      params = {:adapter => "activesalesforce",
        :url => "https://www.salesforce.com",
        :username => user,
        :password => pass + token
      }
      status = self.establish_connection(params)
      puts "Created SfBase connection: ---> " + status.connection.binding.to_s + "\n"
    end

    def initialize()
      puts "---> SfBase initialized.\n"
    end

#    self.establish_connection @@params
    set_table_name 'salesforce_sf_base'
  end

  class Account < SfBase
    set_table_name 'account'
    puts "Account Self.name ---> " + self.name
    puts "Account.table_name ==> " + self.table_name
  end
end

module UnitTests
  class SimpleTest < Test::Unit::TestCase

    @@config = YAML.load_file(File.dirname(__FILE__) + '/config.yml').symbolize_keys
    @@sf_setting = {
      :adapter => @@config[:adapter],
      :url => @@config[:url],
      :username => @@config[:username],
      :password => @@config[:password] + @@config[:security_token],
    }
      
    def setup
      #puts "\nStarting test '#{self.class.name.gsub('::', '')}.#{method_name}'"
      super
      Salesforce::SfBase.login(@@config[:username], @@config[:password], @@config[:security_token])
    end
    
    def test_find_account
      account = Salesforce::Account.find(:first)
      puts "SF account name: " + account.name

      assert account
    end
  end
 
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
asf-soap-adapter-1.3.1 test/tests_without_rail.rb
asf-soap-adapter-1.3.0 test/tests_without_rail.rb
asf-soap-adapter-1.1.0 test/tests_without_rail.rb
asf-soap-adapter-1.0.4 test/tests_without_rail.rb
ryandotsmith-asf-soap-adapter-1.0.3 test/tests_without_rail.rb
asf-soap-adapter-1.0.2 test/tests_without_rail.rb
asf-soap-adapter-1.0.1 test/tests_without_rail.rb
asf-soap-adapter-1.0.0 test/tests_without_rail.rb