Class: Stratagem::Crawler::Authentication::Configured

Inherits:
Base
  • Object
show all
Includes:
AutoMock::UserLoader
Defined in:
lib/stratagem/crawler/authentication/configured.rb

Instance Method Summary collapse

Methods included from AutoMock::UserLoader

#load_user_from_configuration, #matching_credentials

Methods inherited from Base

#authenticate, #authentication, #find_login_form, #guess_login_model, #login, #logout, #populate_login_form, #reset_authentication

Methods included from TraceUtils

#model_invocations_for_request

Instance Method Details

#user_modelsObject



5
6
7
8
9
# File 'lib/stratagem/crawler/authentication/configured.rb', line 5

def user_models
  credentials.map {|user_credentials|
    application_model.models.find {|model| model.klass.name == user_credentials.model }
  }.compact
end

#usersObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/stratagem/crawler/authentication/configured.rb', line 11

def users
  log "Loading users for #{credentials.size} sets of credentials"
  credentials.each do |user_credentials|
    user = load_user_from_configuration(user_credentials)
    if (user)
      log "Loaded credentials for user #{user.id}: #{user.stratagem.mock_attributes.inspect}"
      user.stratagem.related_objects.each do |object|
        (objects_by_class[object.class] ||= []) << object
      end
    end
  end

  log "Loaded #{objects_by_class.keys.size} object types: #{objects_by_class.keys.inspect}"

end