indirect-webrat 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,14 @@
1
+ == 0.7.5 / 2011-11-19
2
+
3
+ * Minor enhancements
4
+
5
+ * have_selector on XML documents without re-parsing them as HTML
6
+
1
7
  == 0.7.4 / 2011-11-19
2
8
 
3
9
  * Minor enhancements
4
10
 
5
- * parse XML as XML instead of as HTML
11
+ * parse XML as XML instead of as HTML (Alex Eagle/Anton Orel)
6
12
  * handle controller redirects correctly (Daniel Libanori)
7
13
  * work with rspec it { should blah } examples (Dmytrii Nagirniak)
8
14
  * compatibility with Launchy 2.0 (Jeremy Hinegardner)
@@ -6,14 +6,19 @@ module Webrat #:nodoc:
6
6
  def self.document(stringlike) #:nodoc:
7
7
  return stringlike.dom if stringlike.respond_to?(:dom)
8
8
 
9
- if Nokogiri::HTML::Document === stringlike
9
+ case stringlike
10
+ when Nokogiri::HTML::Document
11
+ when Nokogiri::XML::NodeSet
10
12
  stringlike
11
- elsif Nokogiri::XML::NodeSet === stringlike
12
- stringlike
13
- elsif stringlike.respond_to?(:body)
14
- Nokogiri.parse(stringlike.body.to_s)
15
13
  else
16
- Nokogiri.parse(stringlike.to_s)
14
+ stringlike = stringlike.body if stringlike.respond_to?(:body)
15
+ stringlike = stringlike.to_s
16
+
17
+ if stringlike =~ /\<\?xml/
18
+ Nokogiri::XML(stringlike)
19
+ else
20
+ Nokogiri::HTML(stringlike)
21
+ end
17
22
  end
18
23
  end
19
24
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{indirect-webrat}
5
- s.version = "0.7.4"
5
+ s.version = "0.7.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Bryan Helmkamp"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: indirect-webrat
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 4
10
- version: 0.7.4
9
+ - 5
10
+ version: 0.7.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bryan Helmkamp