yaks-html 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af536b85c5b8ec153e5c803ddb0051a84bb0b284
4
- data.tar.gz: e9de84047d31aecab97ed462262e972d10da57b3
3
+ metadata.gz: 7dffb43894c21759c2fd140a7a20993538c4abb7
4
+ data.tar.gz: 2ced37b4d06fda844345f177119bc732b277b562
5
5
  SHA512:
6
- metadata.gz: 610b56a2df54cf21201f8c6627a05a9ccecd9439515512f85146753267ddf2003d91712f304b3c080bcdcfea80abe4e51058a9c8aaec1ae535983bcc02547cb3
7
- data.tar.gz: fdad369fdf7116bf6da5551643c7d97f1fb08e1f42b0bb181d716021c23ad76311a4c71f8939cd72546d6ceb23000d6aa7e6f2fc27be947c63b390a215062d65
6
+ metadata.gz: 5fbdf6e3d03909389a80eb0915f1718de7066a0e736cae9ad7b02e3f769c85f9b37e6b494bd14aff745c864de008b35d55517fdbb024b96524d513915abe22f3
7
+ data.tar.gz: 715fac389b3e74f3e8f7f2cdbd0704ce2e40eb1d1c69c7cbe57e37f5ad3f914281d1bc39d0fcf175cc83d8269c1755b97e5a1cf12d9af4445c60d0376eece634
@@ -35,11 +35,11 @@ module YaksHTML
35
35
  end
36
36
 
37
37
  def within_form(name, &block)
38
- within(all("form[@name=\"#{name}\"]").first, &block)
38
+ within(find_form(name), &block)
39
39
  end
40
40
 
41
41
  def submit_form(name, &block)
42
- within(all("form[@name=\"#{name}\"]").first) do
42
+ within(find_form(name)) do
43
43
  yield block
44
44
  submit!
45
45
  end
@@ -52,6 +52,20 @@ module YaksHTML
52
52
  def env
53
53
  YaksHTML::RACK_ENV
54
54
  end
55
+
56
+ private
57
+
58
+ def find_form(name)
59
+ forms = all("form[@name=\"#{name}\"]")
60
+
61
+ if forms.empty?
62
+ fname = "/tmp/page-#{rand(999999999999999)}.html"
63
+ File.write(fname, page.body)
64
+ raise "No form found with name #{name}. Page saved as #{fname}"
65
+ end
66
+
67
+ forms.first
68
+ end
55
69
  end
56
70
  end
57
71
 
@@ -21,7 +21,11 @@ module Yaks
21
21
  end.replace('.yaks-version') do |ver|
22
22
  ver.content(Yaks::VERSION)
23
23
  end.replace('.request-info') do |req|
24
- req.content(env['REQUEST_METHOD'], ' ', env['PATH_INFO'])
24
+ if env['REQUEST_METHOD'] && env['PATH_INFO']
25
+ req.content(env['REQUEST_METHOD'], ' ', env['PATH_INFO'])
26
+ else
27
+ req
28
+ end
25
29
  end
26
30
  end
27
31
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaks-html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arne Brasseur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-09 00:00:00.000000000 Z
11
+ date: 2016-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yaks
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.11.0
19
+ version: 0.12.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.11.0
26
+ version: 0.12.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: hexp
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.2.3
135
+ rubygems_version: 2.5.1
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: HTML output format for Yaks