venom 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,15 +4,17 @@ require 'venom/generators/workshop'
4
4
  module Venom
5
5
  class Generator < Thor
6
6
  desc "workshop NAME", "Create a new workshop."
7
- method_option :driver, aliases: "-d", type: :string, required: false, desc: "Use Symbiont to drive the browser. (Valid value is 'watir'.)"
7
+ method_option :driver, aliases: "-d", type: :string, required: false, desc: "Framework driver to use. (Default value is 'symbiont'.)"
8
8
  method_option :library, aliases: "-l", type: :boolean, desc: "Use a shared library directory."
9
+ method_option :restart, aliases: "-r", type: :boolean, desc: "Restart browser for each scenario."
9
10
 
10
11
  def workshop(name)
11
12
  puts "Name of workshop: #{name}"
12
- driver = options[:driver].nil? ? 'watir' : options[:driver]
13
+ driver = options[:driver].nil? ? 'symbiont' : options[:driver]
13
14
  library = options[:library] == true ? 'true' : 'false'
15
+ restart = options[:restart] == true ? 'true' : 'false'
14
16
 
15
- Venom::Generators::Workshop.start([name, driver, library])
17
+ Venom::Generators::Workshop.start([name, driver, library, restart])
16
18
  end
17
19
  end # class: Generator
18
20
  end # module: Venom
@@ -7,7 +7,9 @@ module Venom
7
7
 
8
8
  argument :name, type: :string, desc: "Name of the workshop."
9
9
  argument :driver, type: :string, desc: "Driver to use with Symbiont."
10
- argument :library, type: :string, desc: "Use shared library directory."
10
+ argument :library, type: :string, desc: "Use a shared library directory."
11
+ argument :restart, type: :string, desc: "Restart browser with each scenario."
12
+
11
13
  desc "Generates a workshop structure."
12
14
 
13
15
  def self.source_root
@@ -17,23 +19,28 @@ module Venom
17
19
  def spit_back_values
18
20
  puts "Create workshop '#{name}' using #{driver}."
19
21
  puts "Use a separate library." if use_library
22
+ puts "Restart browser for each scenario." if restart_browser
20
23
  end
21
24
 
22
25
  def create_workshop_directory
23
26
  empty_directory(name)
24
27
  end
28
+
29
+ def create_library_directory
30
+ empty_directory("#{name}/lib") if use_library
31
+ end
25
32
 
26
33
  def create_workshop_structure
27
34
  empty_directory("#{name}/specs")
28
35
  empty_directory("#{name}/specs/support")
29
- empty_directory("#{name}/specs/support/test_steps")
36
+ if use_library
37
+ empty_directory("#{name}/lib/test_steps")
38
+ else
39
+ empty_directory("#{name}/specs/support/test_steps")
40
+ end
30
41
  empty_directory("#{name}/specs/support/test_data")
31
42
  end
32
-
33
- def create_library_directory
34
- empty_directory("#{name}/lib") if use_library
35
- end
36
-
43
+
37
44
  def create_definitions_directory
38
45
  if use_library
39
46
  empty_directory("#{name}/lib/definitions")
@@ -54,12 +61,16 @@ module Venom
54
61
  template "Gemfile.tt", "#{name}/Gemfile"
55
62
  end
56
63
 
64
+ def copy_driver
65
+ template "driver.rb.tt", "#{name}/specs/support/driver.rb"
66
+ end
67
+
57
68
  def copy_env
58
69
  template "env.rb.tt", "#{name}/specs/support/env.rb"
59
70
  end
60
71
 
61
72
  def copy_hooks
62
- copy_file "hooks.rb", "#{name}/specs/support/hooks.rb"
73
+ template "hooks.rb.tt", "#{name}/specs/support/hooks.rb"
63
74
  end
64
75
 
65
76
  private
@@ -67,6 +78,10 @@ module Venom
67
78
  def use_library
68
79
  library == 'true'
69
80
  end
81
+
82
+ def restart_browser
83
+ restart == 'true'
84
+ end
70
85
  end # class: Workshop
71
86
  end # module: Generators
72
87
  end # module: Venom
@@ -1,9 +1,6 @@
1
1
  gem 'cucumber'
2
2
 
3
- <% unless driver.downcase == 'no driver' -%>
4
- gem 'symbiont'
5
- <% end -%>
3
+ <% if driver.downcase == 'symbiont' -%>gem 'symbiont'<% end -%><% if library == 'true' -%>
6
4
 
7
- <% if library == 'true' -%>
8
- gem 'require_all'
9
- <% end -%>
5
+
6
+ gem 'require_all'<% end -%>
@@ -1,4 +1,6 @@
1
1
  <% browser = "BROWSER=firefox" %>
2
2
  <% std_opts = "--tags ~@wip --color --format pretty --no-source" %>
3
+ <% rpt_opts = "--format html --out output/specs-report.html" %>
3
4
 
4
5
  default: <%= browser %> <%= std_opts %> -r specs specs
6
+ report: <%= browser %> <%= std_opts %> <%= rpt_opts %> -r specs specs
@@ -0,0 +1,28 @@
1
+ <% if library == 'true' -%>$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))
2
+
3
+ <% end -%><% if driver.downcase == 'symbiont' %>require 'symbiont'
4
+ require 'symbiont/factory'
5
+ <% if library == 'true' -%>
6
+ require 'require_all'
7
+
8
+ require_all 'lib'
9
+ <% end -%>
10
+ module Symbiont
11
+ module Browser
12
+
13
+ def self.start
14
+ unless @browser
15
+ @browser = Watir::Browser.new(ENV['BROWSER'])
16
+ end
17
+ @browser
18
+ end
19
+
20
+ def self.stop
21
+ @browser.quit if @browser
22
+ @browser = false
23
+ end
24
+
25
+ end # module: Browser
26
+ end # module: Symbiont
27
+
28
+ World(Symbiont::Factory)<% end -%>
@@ -1,33 +0,0 @@
1
- <% if library == 'true' -%>
2
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))
3
-
4
- <% end -%>
5
- <% unless driver.downcase == 'no driver' -%>
6
- require 'symbiont'
7
- require 'symbiont/factory'
8
- <% if library == 'true' -%>
9
-
10
- require 'require_all'
11
-
12
- require_all 'lib'
13
- <% end -%>
14
-
15
- module Symbiont
16
- module Browser
17
-
18
- def self.start
19
- unless @browser
20
- <% if driver.downcase == 'watir' -%>
21
- @browser = Watir::Browser.new(ENV['BROWSER'])<% end %>
22
- end
23
- @browser
24
- end
25
-
26
- def self.stop
27
- @browser.quit if @browser
28
- end
29
-
30
- end # module: Browser
31
- end # module: Symbiont
32
-
33
- World(Symbiont::Factory)<% end %>
@@ -2,10 +2,17 @@ AfterConfiguration do |config|
2
2
  puts("Tests are being executed from: #{config.feature_dirs}")
3
3
  end
4
4
 
5
+ <% if driver.downcase == 'symbiont' -%>
5
6
  Before do
6
7
  @browser = Symbiont::Browser.start
7
8
  end
9
+ <% if restart == 'true' -%>
8
10
 
9
- at_exit do
11
+ After do
10
12
  Symbiont::Browser.stop
11
13
  end
14
+ <% end -%>
15
+
16
+ at_exit do
17
+ Symbiont::Browser.stop
18
+ end<% end -%>
@@ -1,3 +1,3 @@
1
1
  module Venom
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -14,4 +14,7 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "venom"
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Venom::VERSION
17
+
18
+ gem.add_runtime_dependency 'require_all', '1.2.1'
19
+ gem.add_runtime_dependency 'symbiont', '>= 0.1.4'
17
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: venom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,39 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-08-09 00:00:00.000000000 Z
13
- dependencies: []
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: require_all
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.2.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - '='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.2.1
30
+ - !ruby/object:Gem::Dependency
31
+ name: symbiont
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.1.4
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.1.4
14
46
  description: A test generator for Symbiont.
15
47
  email:
16
48
  - jeffnyman@gmail.com
@@ -31,8 +63,9 @@ files:
31
63
  - lib/venom/generators/workshop/Gemfile.tt
32
64
  - lib/venom/generators/workshop/Rakefile
33
65
  - lib/venom/generators/workshop/cucumber.yml
66
+ - lib/venom/generators/workshop/driver.rb.tt
34
67
  - lib/venom/generators/workshop/env.rb.tt
35
- - lib/venom/generators/workshop/hooks.rb
68
+ - lib/venom/generators/workshop/hooks.rb.tt
36
69
  - lib/venom/version.rb
37
70
  - venom.gemspec
38
71
  homepage: ''