test-harness 0.4.10 → 0.4.11

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.10
1
+ 0.4.11
@@ -0,0 +1,17 @@
1
+ class TestHarness
2
+ class FormStruct
3
+ attr_accessor :browser
4
+
5
+ def initialize(browser)
6
+ self.browser = browser
7
+ end
8
+
9
+ def method_missing(name, *args, &block)
10
+ id = name.to_s.chomp('=')
11
+ value = args[0]
12
+ field = browser.find_field(id)
13
+ field[:type] =~ /^select/ ? field.select(value) : field.set(value)
14
+ end
15
+ end
16
+ end
17
+
data/lib/test_harness.rb CHANGED
@@ -62,6 +62,7 @@ end
62
62
 
63
63
  require 'given'
64
64
  require 'ui_helper'
65
+ require 'form_struct'
65
66
 
66
67
  require 'ui_component'
67
68
  require 'ui_component_helper'
@@ -69,11 +69,6 @@ class TestHarness
69
69
  # submit!
70
70
  #
71
71
  def submit!
72
- form_hash.each do |k,v|
73
- field = find_field(k.to_s)
74
- field[:type] =~ /^select/ ? field.select(v) : field.set(v)
75
- end
76
-
77
72
  if has_css?(locator = component.submit)
78
73
  find(:css, component.submit).click
79
74
  else
@@ -87,12 +82,12 @@ class TestHarness
87
82
  # form.password = 'password'
88
83
  # submit!
89
84
  def form
90
- @form ||= OpenStruct.new
85
+ @form ||= TestHarness::FormStruct.new(browser)
91
86
  end
92
87
 
93
88
  private
94
89
  def form_hash
95
- form.instance_variable_get("@table")
90
+ form.instance_variable_get("@table") || {}
96
91
  end
97
92
 
98
93
  private
data/test-harness.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "test-harness"
8
- s.version = "0.4.10"
8
+ s.version = "0.4.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Maher Hawash"]
12
- s.date = "2013-03-31"
12
+ s.date = "2013-04-09"
13
13
  s.description = "A test harness for rspec and cucumber which allows for separating responsibility between setting up the context and interacting with the browser, and cleaning up the step definition files."
14
14
  s.email = "gmhawash@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  "Rakefile",
28
28
  "VERSION",
29
29
  "lib/configuration.rb",
30
+ "lib/form_struct.rb",
30
31
  "lib/given.rb",
31
32
  "lib/mental_model.rb",
32
33
  "lib/test_harness.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-harness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10
4
+ version: 0.4.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-31 00:00:00.000000000 Z
12
+ date: 2013-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -111,6 +111,7 @@ files:
111
111
  - Rakefile
112
112
  - VERSION
113
113
  - lib/configuration.rb
114
+ - lib/form_struct.rb
114
115
  - lib/given.rb
115
116
  - lib/mental_model.rb
116
117
  - lib/test_harness.rb
@@ -145,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
146
  version: '0'
146
147
  segments:
147
148
  - 0
148
- hash: 1560447206924822776
149
+ hash: -553788856980005565
149
150
  required_rubygems_version: !ruby/object:Gem::Requirement
150
151
  none: false
151
152
  requirements: