splinter 0.0.4 → 0.0.5

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.
@@ -43,9 +43,7 @@ module Splinter
43
43
  # t.time :publish_at, Time.now
44
44
  # end
45
45
  def complete_form(base)
46
- form = FormCompleter.new(base)
47
- yield form
48
- form.each_input { |method, *args| send(method, *args) }
46
+ yield FormCompleter.new(base, self)
49
47
  find(:xpath, "//form[contains(@id,'#{base}')]//input[@type='submit']").click
50
48
  end
51
49
 
@@ -1,44 +1,40 @@
1
1
  module Splinter
2
2
  module Capybara
3
- # The FormCompleter is a simple stack that keeps track of Capybara actions
4
- # to run.
3
+ # The FormCompleter is a simple proxy that delegates actions to a Capybara
4
+ # session.
5
5
  class FormCompleter
6
- def initialize(base)
7
- @base = base
8
- @stack = []
6
+ def initialize(base, page)
7
+ @base = base
8
+ @page = page
9
9
  end
10
10
 
11
11
  def text_field(id, value)
12
- @stack << [:fill_in, "#{@base}_#{id}", { :with => value.to_s }]
12
+ @page.send :fill_in, "#{@base}_#{id}", { :with => value.to_s }
13
13
  end
14
14
  alias text_area text_field
15
15
 
16
16
  def checkbox(id, value = nil)
17
- @stack << [value ? :check : :uncheck, "#{@base}_#{id}"]
17
+ @page.send value ? :check : :uncheck, "#{@base}_#{id}"
18
18
  end
19
19
 
20
20
  def radio(id, value)
21
- @stack << [:choose, "#{@base}_#{id}_#{value}"]
21
+ @page.send :choose, "#{@base}_#{id}_#{value}"
22
22
  end
23
23
 
24
24
  def select(id, value)
25
- @stack << [:find_and_select_option, "#{@base}_#{id}", value]
25
+ @page.send :find_and_select_option, "#{@base}_#{id}", value
26
26
  end
27
27
 
28
28
  def time(id, value)
29
- @stack << [:select_time, value, { :id_prefix => "#{@base}_#{id}" }]
29
+ @page.send :select_time, value, { :id_prefix => "#{@base}_#{id}" }
30
30
  end
31
31
 
32
32
  def date(id, value)
33
- @stack << [:select_date, value, { :id_prefix => "#{@base}_#{id}" }]
33
+ @page.send :select_date, value, { :id_prefix => "#{@base}_#{id}" }
34
34
  end
35
35
 
36
36
  def datetime(id, value)
37
- @stack << [:select_datetime, value, { :id_prefix => "#{@base}_#{id}" }]
38
- end
39
-
40
- def each_input(&block)
41
- @stack.each(&block)
37
+ @page.send :select_datetime, value, { :id_prefix => "#{@base}_#{id}" }
42
38
  end
43
39
  end
44
40
  end
@@ -1,3 +1,3 @@
1
1
  module Splinter
2
- VERSION = Version = '0.0.4'
2
+ VERSION = Version = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splinter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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: 2012-06-28 00:00:00.000000000 Z
12
+ date: 2012-09-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capybara
@@ -100,20 +100,20 @@ extra_rdoc_files:
100
100
  files:
101
101
  - Rakefile
102
102
  - README.markdown
103
- - lib/splinter/rspec/deferred_garbage_collection.rb
104
- - lib/splinter/rspec/shared_connection.rb
103
+ - lib/splinter/capybara/actions.rb
104
+ - lib/splinter/capybara/form_completer.rb
105
+ - lib/splinter/capybara.rb
105
106
  - lib/splinter/perf/deferred_garbage_collection.rb
106
107
  - lib/splinter/perf/shared_connection.rb
108
+ - lib/splinter/rspec/deferred_garbage_collection.rb
109
+ - lib/splinter/rspec/shared_connection.rb
107
110
  - lib/splinter/rspec.rb
108
111
  - lib/splinter/version.rb
109
- - lib/splinter/capybara/form_completer.rb
110
- - lib/splinter/capybara/actions.rb
111
- - lib/splinter/capybara.rb
112
112
  - lib/splinter.rb
113
- - spec/splinter/capybara/actions_spec.rb
114
113
  - spec/spec_helper.rb
115
- - spec/test_app/views/index.erb
114
+ - spec/splinter/capybara/actions_spec.rb
116
115
  - spec/test_app/server.rb
116
+ - spec/test_app/views/index.erb
117
117
  homepage: https://github.com/site5/splinter
118
118
  licenses: []
119
119
  post_install_message:
@@ -140,4 +140,3 @@ signing_key:
140
140
  specification_version: 3
141
141
  summary: Splinter is a Capybara Ninja
142
142
  test_files: []
143
- has_rdoc: