Class: WatiRspec::Runner
- Inherits:
-
Object
- Object
- WatiRspec::Runner
- Defined in:
- lib/watirspec/runner.rb
Overview
WatiRspec runner class is responsible for:
-
generating directory structures for projects
-
starting RSpec with specified settings
Constant Summary collapse
- @@template_directory =
File.join(File.dirname(__FILE__), "../../templates/")
Class Method Summary collapse
-
.generate ⇒ Object
Generates ui-test project structure for project.
-
.generate_common ⇒ Object
Generates ui-test-common directory structure.
-
.help ⇒ Object
Shows help.
-
.run ⇒ Object
Run RSpec with custom settings * loads spec.opts from project’s directory if exists * loads environment.rb from project’s directory if exists * loads custom Formatter.
Class Method Details
.generate ⇒ Object
Generates ui-test project structure for project
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/watirspec/runner.rb', line 29 def generate ui_test_dir = File.join(Dir.pwd, "ui-test") puts "Creating WatiRspec project directory structure to #{ui_test_dir}..." require "fileutils" FileUtils.cp_r File.join(@@template_directory, "project/."), ui_test_dir puts "Done" return 0 rescue => e puts "Failed:" puts e. return -1 end |
.generate_common ⇒ Object
Generates ui-test-common directory structure
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/watirspec/runner.rb', line 43 def generate_common common_dir = File.join(Dir.pwd, "ui-test-common") puts "Creating WatiRspec common project directory structure to #{common_dir}..." require "fileutils" FileUtils.cp_r File.join(@@template_directory, "common/."), common_dir puts "Done" return 0 rescue => e puts "Failed:" puts e. return -1 end |
.help ⇒ Object
Shows help
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/watirspec/runner.rb', line 57 def help puts %Q{WatiRspec: Usage: watirspec (COMMAND|FILE(:LINE)?|DIRECTORY|GLOB)+ [options] Commands: * generate - generate default directory structure for new project * generate_common - generate common project directory structure * help - show this help * --help - show RSpec's help All other commands/options will be passed to RSpec directly.} return 1 end |
.run ⇒ Object
Run RSpec with custom settings
-
loads spec.opts from project’s directory if exists
-
loads environment.rb from project’s directory if exists
-
loads custom Formatter
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/watirspec/runner.rb', line 15 def run unless ARGV.empty? require "watirspec" load_formatter load_project_env else return help end ::Spec::Runner::CommandLine.run end |