Class: LeapSalesforce::Generator::PageObjects

Inherits:
Object
  • Object
show all
Includes:
LeapSalesforce::Generator
Defined in:
lib/leap_salesforce_ui/generator/page_objects.rb

Overview

Creates SoqlObjects and related modules

Constant Summary collapse

POM_FOLDER =
File.join(LeapSalesforce.lib_folder, "page_objects").freeze

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
# File 'lib/leap_salesforce_ui/generator/page_objects.rb', line 14

def create
  LeapSalesforce.objects_to_verify.each { |entity| create_poms_for entity }
end

#create_poms_for(entity) ⇒ Object

Parameters:

  • entity (LeapSalesforce::SoqlData)

    An object representing an object in Salesforce



19
20
21
22
23
24
25
26
27
# File 'lib/leap_salesforce_ui/generator/page_objects.rb', line 19

def create_poms_for(entity)
  @entity_name = entity
  @soql_object = LeapSalesforce.soql_objects.find { |so| so.class_name == entity.to_s }
  %w[create view update].each do |page_action|
    content = read_template "#{page_action}_page.rb.erb", binding, folder: __dir__
    file = File.join(POM_FOLDER, "#{@entity_name.to_s.snakecase}/#{page_action}_page.rb")
    generate_file file, content, overwrite: false
  end
end