Class: WatirInstall::Generators::Test

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/watir_install/generators/test.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



14
15
16
# File 'lib/watir_install/generators/test.rb', line 14

def self.source_root
  "#{File.dirname(__FILE__)}/tests"
end

Instance Method Details

#data_filesObject



26
27
28
29
30
31
# File 'lib/watir_install/generators/test.rb', line 26

def data_files
  file = "#{Dir.pwd}/spec/#{klass.downcase}_spec.rb"
  erb = form == 'true' ? "crud" : "spec"
  template "spec/#{erb}.rb.tt", file
  @git.add(file) if @git
end

#gitObject



18
19
20
# File 'lib/watir_install/generators/test.rb', line 18

def git
  @git = Git.open('./') if Dir.entries('./').include?('.git')
end

#nameObject



22
23
24
# File 'lib/watir_install/generators/test.rb', line 22

def name
  Dir.pwd[/[^\/]*$/]
end