visible-cukes 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/visible_cukes.rb CHANGED
@@ -1,55 +1,11 @@
1
- require 'webrat'
2
-
3
- module Webrat
4
- class ButtonField
5
- end
6
-
7
- class SelectOption
8
- alias :standard_choose :choose
9
-
10
- def choose
11
- standard_choose
12
- current_selections = XML.xpath_search(select_element, ".//option[@selected = 'selected']")
13
- remove_selection_from current_selections unless current_selections.empty?
14
- @element['selected'] = ''
15
- end
16
-
17
- private
18
-
19
- def remove_selection_from options
20
- options.each {|option| option.remove_attribute 'selected' }
21
- end
22
- end
23
-
24
- class TextField
25
- def set(value)
26
- @value = value
27
- @element['value'] = value
28
- end
29
- end
30
-
31
- class TextAreaField
32
- end
33
-
34
- class CheckboxField
35
- end
36
-
37
- class RadioField
38
- end
39
-
40
- class PasswordField
41
- end
42
-
43
- class FileField
44
- end
45
-
46
- class ResetField
47
- end
48
- end
1
+ require 'webrat_extensions'
49
2
 
50
3
  class VisibleCukes < Cucumber::Formatter::Html
51
4
  def initialize(step_mother, io, options)
52
5
  super(step_mother, io, options)
6
+ raise "You must specify --out FILE for visible-cukes" unless File === io
7
+
8
+ FileUtils.makedirs('./visible-cukes/pages')
53
9
 
54
10
  @rb = step_mother.load_programming_language('rb')
55
11
  end
@@ -62,7 +18,7 @@ class VisibleCukes < Cucumber::Formatter::Html
62
18
 
63
19
  def visit_step(step)
64
20
  @step_id = step.dom_id
65
- html_filename = "feature_pages/#{@current_page_name_prefix}_#{@current_page_name_count}.html"
21
+ html_filename = "pages/#{@current_page_name_prefix}_#{@current_page_name_count}.html"
66
22
  @current_page_name_count += 1
67
23
  @builder.a(:href => html_filename) do
68
24
  super
@@ -73,7 +29,7 @@ class VisibleCukes < Cucumber::Formatter::Html
73
29
  private
74
30
 
75
31
  def save_file html_filename
76
- full_path = File.expand_path("./doc/#{html_filename}")
32
+ full_path = File.expand_path("./visible-cukes/#{html_filename}")
77
33
  unless has_response?
78
34
  File.open(full_path, 'w') do |f|
79
35
  f.write(current_page)
@@ -0,0 +1,48 @@
1
+ require 'webrat'
2
+
3
+ module Webrat
4
+ class ButtonField
5
+ end
6
+
7
+ class SelectOption
8
+ alias :standard_choose :choose
9
+
10
+ def choose
11
+ standard_choose
12
+ current_selections = XML.xpath_search(select_element, ".//option[@selected = 'selected']")
13
+ remove_selection_from current_selections unless current_selections.empty?
14
+ @element['selected'] = ''
15
+ end
16
+
17
+ private
18
+
19
+ def remove_selection_from options
20
+ options.each {|option| option.remove_attribute 'selected' }
21
+ end
22
+ end
23
+
24
+ class TextField
25
+ def set(value)
26
+ @value = value
27
+ @element['value'] = value
28
+ end
29
+ end
30
+
31
+ class TextAreaField
32
+ end
33
+
34
+ class CheckboxField
35
+ end
36
+
37
+ class RadioField
38
+ end
39
+
40
+ class PasswordField
41
+ end
42
+
43
+ class FileField
44
+ end
45
+
46
+ class ResetField
47
+ end
48
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visible-cukes
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.1"
4
+ version: "0.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moss Collum
@@ -9,10 +9,29 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-22 00:00:00 -04:00
12
+ date: 2009-10-24 00:00:00 -04:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: webrat
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.5.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: cucumber
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.102
34
+ version:
16
35
  description: VisibleCukes is a Cucumber formatter that saves screenshots after each Webrat step.
17
36
  email: moss.collum@gmail.com
18
37
  executables: []
@@ -23,6 +42,7 @@ extra_rdoc_files: []
23
42
 
24
43
  files:
25
44
  - lib/visible_cukes.rb
45
+ - lib/webrat_extensions.rb
26
46
  has_rdoc: true
27
47
  homepage: http://github.com/moss/visible-cukes
28
48
  licenses: []