Class: SeleniumRecord::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- SeleniumRecord::Generators::InstallGenerator
- Defined in:
- lib/generators/selenium_record/install_generator.rb
Overview
Generator for installing selenium record in project
Instance Method Summary collapse
- #add_includes_spec_helper ⇒ Object
- #create_autoload ⇒ Object
-
#create_base_dir ⇒ Object
def create_initializer_file template ‘selenium_record.rb.erb’, ‘config/initializers/selenium_record.rb’ end.
- #create_common_components ⇒ Object
- #create_navigation_components ⇒ Object
Instance Method Details
#add_includes_spec_helper ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/generators/selenium_record/install_generator.rb', line 43 def add_includes_spec_helper prepend_to_file 'spec/spec_helper.rb' do "# SeleniumRecord install configuration\n" \ "require 'selenium-webdriver'\n" \ "require 'selenium_record'\n" \ "require_relative 'support/selenium_objects/base'\n\n" end end |
#create_autoload ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/generators/selenium_record/install_generator.rb', line 35 def create_autoload @navigation_components = [:navigation_components] @navigation_folders = @navigation_components.map do |component| ActiveSupport::Inflector.pluralize(component) end.join(' ') template 'autoload.rb.erb', File.join(object_module_path, 'autoload.rb') end |
#create_base_dir ⇒ Object
def create_initializer_file
template 'selenium_record.rb.erb',
'config/initializers/selenium_record.rb'
end
23 24 25 |
# File 'lib/generators/selenium_record/install_generator.rb', line 23 def create_base_dir empty_directory object_module_path end |
#create_common_components ⇒ Object
27 28 29 |
# File 'lib/generators/selenium_record/install_generator.rb', line 27 def create_common_components %w(page view).each { |c| create_component(c) } end |
#create_navigation_components ⇒ Object
31 32 33 |
# File 'lib/generators/selenium_record/install_generator.rb', line 31 def [:navigation_components].each { |c| create_component(c) } end |