eetee 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/eetee/ext/rack.rb +0 -59
- data/lib/eetee/runner.rb +1 -1
- data/lib/eetee/version.rb +1 -1
- data/lib/guard/Guardfile +5 -0
- data/lib/guard/eetee.rb +6 -0
- data/tests/multi/run.rb +1 -1
- metadata +5 -4
data/lib/eetee/ext/rack.rb
CHANGED
@@ -14,65 +14,6 @@ module HTTPTest
|
|
14
14
|
@app.last_response
|
15
15
|
end
|
16
16
|
|
17
|
-
def propfind(url, properties = :all, opts = {})
|
18
|
-
namespaces = {
|
19
|
-
'DAV:' => 'D',
|
20
|
-
'urn:ietf:params:xml:ns:carddav' => 'C',
|
21
|
-
'http://calendarserver.org/ns/' => 'APPLE1'
|
22
|
-
}
|
23
|
-
|
24
|
-
if properties == :all
|
25
|
-
body = "<D:allprop />"
|
26
|
-
|
27
|
-
else
|
28
|
-
properties = properties.map do |(name, ns)|
|
29
|
-
ns_short = namespaces[ns]
|
30
|
-
raise "unknown namespace: #{ns}" unless ns_short
|
31
|
-
%.<#{ns_short}:#{name}/>.
|
32
|
-
end
|
33
|
-
|
34
|
-
body = "<D:prop>#{properties.join("\n")}</D:prop>"
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
data = <<-EOS
|
39
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
40
|
-
<D:propfind xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav" xmlns:APPLE1="http://calendarserver.org/ns/">
|
41
|
-
#{body}
|
42
|
-
</D:propfind>
|
43
|
-
EOS
|
44
|
-
|
45
|
-
request('PROPFIND', url, opts.merge(input: data))
|
46
|
-
end
|
47
|
-
|
48
|
-
def ensure_element_exists(response, expr, namespaces = {'D' => 'DAV:'})
|
49
|
-
ret = Nokogiri::XML(response.body)
|
50
|
-
ret.css(expr, namespaces).tap{|elements| elements.should.not.be.empty? }
|
51
|
-
rescue EEtee::AssertionFailed => err
|
52
|
-
raise EEtee::AssertionFailed.new("XML did not match: #{expr}")
|
53
|
-
end
|
54
|
-
|
55
|
-
def ensure_element_does_not_exists(response, expr, namespaces = {})
|
56
|
-
ret = Nokogiri::XML(response.body)
|
57
|
-
ret.css(expr, namespaces).should.be.empty?
|
58
|
-
rescue EEtee::AssertionFailed => err
|
59
|
-
raise EEtee::AssertionFailed.new("XML did match: #{expr}")
|
60
|
-
end
|
61
|
-
|
62
|
-
def element_content(response, expr, namespaces = {})
|
63
|
-
ret = Nokogiri::XML(response.body)
|
64
|
-
elements = ret.css(expr, namespaces)
|
65
|
-
if elements.empty?
|
66
|
-
:missing
|
67
|
-
else
|
68
|
-
children = elements.first.element_children
|
69
|
-
if children.empty?
|
70
|
-
:empty
|
71
|
-
else
|
72
|
-
children.first.text
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
17
|
end
|
77
18
|
|
78
19
|
EEtee::Context.__send__(:include, HTTPTest)
|
data/lib/eetee/runner.rb
CHANGED
data/lib/eetee/version.rb
CHANGED
data/lib/guard/Guardfile
ADDED
data/lib/guard/eetee.rb
CHANGED
data/tests/multi/run.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eetee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
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-12-
|
12
|
+
date: 2012-12-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: term-ansicolor
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- lib/eetee/shared.rb
|
64
64
|
- lib/eetee/test.rb
|
65
65
|
- lib/eetee/version.rb
|
66
|
+
- lib/guard/Guardfile
|
66
67
|
- lib/guard/eetee.rb
|
67
68
|
- specs/spec_helper.rb
|
68
69
|
- specs/unit/assertion_wrapper_spec.rb
|
@@ -87,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
88
|
version: '0'
|
88
89
|
segments:
|
89
90
|
- 0
|
90
|
-
hash: -
|
91
|
+
hash: -3545778618917572052
|
91
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
93
|
none: false
|
93
94
|
requirements:
|
@@ -96,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
97
|
version: '0'
|
97
98
|
segments:
|
98
99
|
- 0
|
99
|
-
hash: -
|
100
|
+
hash: -3545778618917572052
|
100
101
|
requirements: []
|
101
102
|
rubyforge_project:
|
102
103
|
rubygems_version: 1.8.23
|