honkster-webrat 0.6.0.10 → 0.7.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/Gemfile +0 -6
  2. data/History.txt +34 -0
  3. data/Rakefile +7 -8
  4. data/Thorfile +1 -0
  5. data/honkster-webrat.gemspec +9 -5
  6. data/lib/webrat.rb +1 -1
  7. data/lib/webrat/adapters/mechanize.rb +22 -6
  8. data/lib/webrat/adapters/rack.rb +4 -0
  9. data/lib/webrat/adapters/rails.rb +4 -8
  10. data/lib/webrat/core/configuration.rb +23 -4
  11. data/lib/webrat/core/elements/field.rb +40 -89
  12. data/lib/webrat/core/elements/form.rb +55 -31
  13. data/lib/webrat/core/locators/form_locator.rb +1 -1
  14. data/lib/webrat/core/locators/select_option_locator.rb +1 -1
  15. data/lib/webrat/core/matchers/have_content.rb +1 -1
  16. data/lib/webrat/core/matchers/have_xpath.rb +4 -2
  17. data/lib/webrat/core/methods.rb +1 -1
  18. data/lib/webrat/core/mime.rb +2 -2
  19. data/lib/webrat/core/save_and_open_page.rb +3 -23
  20. data/lib/webrat/core/scope.rb +1 -0
  21. data/lib/webrat/core/session.rb +4 -7
  22. data/lib/webrat/core_extensions/{nil_to_param.rb → nil_to_query_string.rb} +1 -1
  23. data/lib/webrat/selenium/location_strategy_javascript/label.js +8 -2
  24. data/lib/webrat/selenium/matchers/have_content.rb +22 -10
  25. data/lib/webrat/selenium/matchers/have_selector.rb +8 -0
  26. data/lib/webrat/selenium/matchers/have_xpath.rb +8 -0
  27. data/lib/webrat/selenium/selenium_rc_server.rb +5 -2
  28. data/lib/webrat/selenium/selenium_session.rb +12 -12
  29. data/spec/fakes/test_adapter.rb +1 -5
  30. data/spec/integration/mechanize/sample_app.rb +16 -1
  31. data/spec/integration/mechanize/spec/mechanize_spec.rb +9 -1
  32. data/spec/integration/rack/app.rb +2 -2
  33. data/spec/integration/rack/test/helper.rb +0 -1
  34. data/spec/integration/rack/test/webrat_rack_test.rb +3 -2
  35. data/spec/integration/sinatra/classic_app.rb +0 -1
  36. data/spec/integration/sinatra/modular_app.rb +0 -1
  37. data/spec/integration/sinatra/test/classic_app_test.rb +1 -0
  38. data/spec/integration/sinatra/test/test_helper.rb +0 -1
  39. data/spec/private/core/field_spec.rb +1 -1
  40. data/spec/private/core/form_spec.rb +51 -0
  41. data/spec/private/core/session_spec.rb +5 -23
  42. data/spec/private/mechanize/mechanize_adapter_spec.rb +24 -1
  43. data/spec/private/rails/attaches_file_spec.rb +33 -0
  44. data/spec/private/rails/rails_adapter_spec.rb +0 -7
  45. data/spec/public/matchers/contain_spec.rb +8 -15
  46. data/spec/public/matchers/have_xpath_spec.rb +6 -0
  47. data/spec/public/save_and_open_spec.rb +4 -25
  48. data/spec/public/select_spec.rb +19 -0
  49. data/spec/public/submit_form_spec.rb +52 -1
  50. data/spec/spec_helper.rb +0 -1
  51. data/vendor/selenium-server.jar +0 -0
  52. metadata +56 -15
  53. data/pkg/honkster-webrat-0.6.0.9.gem +0 -0
@@ -1,5 +1,56 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
2
 
3
3
  describe "submit_form" do
4
- it "needs specs"
4
+ it "should submit forms by ID" do
5
+ with_html <<-HTML
6
+ <html>
7
+ <form id="form1" action="/form1">
8
+ <label for="email">Email:</label> <input type="text" id="email" name="email" /></label>
9
+ <input type="submit" value="Add" />
10
+ </form>
11
+ </html>
12
+ HTML
13
+
14
+ webrat_session.should_receive(:get).with("/form1", "email" => "test@example.com")
15
+
16
+ fill_in "Email", :with => "test@example.com"
17
+ submit_form "form1"
18
+ end
19
+
20
+ it "should submit forms by CSS" do
21
+ with_html <<-HTML
22
+ <html>
23
+ <form id="form1" action="/form1">
24
+ <label for="email">Email:</label> <input id="email" type="text" name="email" />
25
+ <input type="submit" value="Add" />
26
+ </form>
27
+ </html>
28
+ HTML
29
+
30
+ webrat_session.should_receive(:get).with("/form1", "email" => "test@example.com")
31
+
32
+ fill_in "Email", :with => "test@example.com"
33
+ submit_form "form[action='/form1']"
34
+ end
35
+
36
+ it "should give priority to selecting forms by ID" do
37
+ with_html <<-HTML
38
+ <html>
39
+ <form action="/form1">
40
+ <label for="email">Email:</label> <input id="email" type="text" name="email" />
41
+ <input type="submit" value="Add" />
42
+ </form>
43
+
44
+ <form action="/form2" id="form">
45
+ <label for="email2">Another email:</label> <input id="email2" type="text" name="email" />
46
+ <input type="submit" value="Add" />
47
+ </form>
48
+ </html>
49
+ HTML
50
+
51
+ webrat_session.should_receive(:get).with("/form2", "email" => "test@example.com")
52
+
53
+ fill_in "Another email", :with => "test@example.com"
54
+ submit_form "form"
55
+ end
5
56
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,3 @@
1
- require "rubygems"
2
1
  require "test/unit"
3
2
  require "spec"
4
3
 
Binary file
metadata CHANGED
@@ -1,7 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honkster-webrat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.10
4
+ hash: 113
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 7
9
+ - 1
10
+ - 1
11
+ version: 0.7.1.1
5
12
  platform: ruby
6
13
  authors:
7
14
  - Bryan Helmkamp
@@ -9,29 +16,56 @@ autorequire:
9
16
  bindir: bin
10
17
  cert_chain: []
11
18
 
12
- date: 2009-12-22 00:00:00 -08:00
19
+ date: 2010-04-26 00:00:00 -07:00
13
20
  default_executable:
14
21
  dependencies:
15
22
  - !ruby/object:Gem::Dependency
16
23
  name: nokogiri
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
20
27
  requirements:
21
28
  - - ">="
22
29
  - !ruby/object:Gem::Version
30
+ hash: 31
31
+ segments:
32
+ - 1
33
+ - 2
34
+ - 0
23
35
  version: 1.2.0
24
- version:
36
+ type: :runtime
37
+ version_requirements: *id001
25
38
  - !ruby/object:Gem::Dependency
26
39
  name: rack
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
30
43
  requirements:
31
44
  - - ">="
32
45
  - !ruby/object:Gem::Version
46
+ hash: 15
47
+ segments:
48
+ - 1
49
+ - 0
33
50
  version: "1.0"
34
- version:
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: rack-test
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 13
62
+ segments:
63
+ - 0
64
+ - 5
65
+ - 3
66
+ version: 0.5.3
67
+ type: :runtime
68
+ version_requirements: *id003
35
69
  description: |-
36
70
  Webrat lets you quickly write expressive and robust acceptance tests
37
71
  for a Ruby web application. It supports simulating a browser inside
@@ -102,7 +136,7 @@ files:
102
136
  - lib/webrat/core_extensions/deprecate.rb
103
137
  - lib/webrat/core_extensions/detect_mapped.rb
104
138
  - lib/webrat/core_extensions/meta_class.rb
105
- - lib/webrat/core_extensions/nil_to_param.rb
139
+ - lib/webrat/core_extensions/nil_to_query_string.rb
106
140
  - lib/webrat/core_extensions/tcp_socket.rb
107
141
  - lib/webrat/integrations/merb.rb
108
142
  - lib/webrat/integrations/rails.rb
@@ -133,7 +167,6 @@ files:
133
167
  - lib/webrat/selenium/selenium_rc_server.rb
134
168
  - lib/webrat/selenium/selenium_session.rb
135
169
  - lib/webrat/selenium/silence_stream.rb
136
- - pkg/honkster-webrat-0.6.0.9.gem
137
170
  - spec/fakes/test_adapter.rb
138
171
  - spec/integration/mechanize/Rakefile
139
172
  - spec/integration/mechanize/config.ru
@@ -226,6 +259,7 @@ files:
226
259
  - spec/integration/sinatra/test/test_helper.rb
227
260
  - spec/private/core/configuration_spec.rb
228
261
  - spec/private/core/field_spec.rb
262
+ - spec/private/core/form_spec.rb
229
263
  - spec/private/core/link_spec.rb
230
264
  - spec/private/core/session_spec.rb
231
265
  - spec/private/mechanize/mechanize_adapter_spec.rb
@@ -274,21 +308,27 @@ rdoc_options: []
274
308
  require_paths:
275
309
  - lib
276
310
  required_ruby_version: !ruby/object:Gem::Requirement
311
+ none: false
277
312
  requirements:
278
313
  - - ">="
279
314
  - !ruby/object:Gem::Version
315
+ hash: 3
316
+ segments:
317
+ - 0
280
318
  version: "0"
281
- version:
282
319
  required_rubygems_version: !ruby/object:Gem::Requirement
320
+ none: false
283
321
  requirements:
284
322
  - - ">="
285
323
  - !ruby/object:Gem::Version
324
+ hash: 3
325
+ segments:
326
+ - 0
286
327
  version: "0"
287
- version:
288
328
  requirements: []
289
329
 
290
330
  rubyforge_project: webrat
291
- rubygems_version: 1.3.5
331
+ rubygems_version: 1.3.7
292
332
  signing_key:
293
333
  specification_version: 3
294
334
  summary: Ruby Acceptance Testing for Web applications
@@ -345,6 +385,7 @@ test_files:
345
385
  - spec/integration/sinatra/test/test_helper.rb
346
386
  - spec/private/core/configuration_spec.rb
347
387
  - spec/private/core/field_spec.rb
388
+ - spec/private/core/form_spec.rb
348
389
  - spec/private/core/link_spec.rb
349
390
  - spec/private/core/session_spec.rb
350
391
  - spec/private/mechanize/mechanize_adapter_spec.rb
Binary file