Created
November 2, 2011 15:07
-
-
Save benlangfeld/1333863 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
class MyNode < Nokogiri::XML::Node | |
def self.new(*args) | |
super | |
end | |
end | |
class MyNode2 < Nokogiri::XML::Node | |
def initialize(*args) | |
super | |
end | |
end | |
describe MyNode do | |
subject { MyNode.new 'foo', Nokogiri::XML::Document.new } | |
its(:name) { should == 'foo' } | |
it 'should read/write attributes correctly' do | |
subject['foo'] = 'bar' | |
subject.attributes['foo'].should be_a Nokogiri::XML::Attr | |
end | |
end | |
describe MyNode2 do | |
subject { MyNode2.new 'foo', Nokogiri::XML::Document.new } | |
its(:name) { should == 'foo' } | |
it 'should read/write attributes correctly' do | |
subject['foo'] = 'bar' | |
subject.attributes['foo'].should be_a Nokogiri::XML::Attr | |
end | |
end | |
describe Nokogiri::XML::Node do | |
subject { Nokogiri::XML::Node.new 'foo', Nokogiri::XML::Document.new } | |
its(:name) { should == 'foo' } | |
it 'should read/write attributes correctly' do | |
subject['foo'] = 'bar' | |
subject.attributes['foo'].should be_a Nokogiri::XML::Attr | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{15:05}[jruby-1.6.5]~/Desktop ben% rspec nokogiri_java.rb | |
F.F... | |
Failures: | |
1) MyNode should read/write attributes correctly | |
Failure/Error: subject.attributes['foo'].should be_a Nokogiri::XML::Attr | |
expected nil to be a kind of Nokogiri::XML::Attr | |
# ./nokogiri_java.rb:22:in `(root)' | |
2) MyNode2 should read/write attributes correctly | |
Failure/Error: subject.attributes['foo'].should be_a Nokogiri::XML::Attr | |
expected nil to be a kind of Nokogiri::XML::Attr | |
# ./nokogiri_java.rb:33:in `(root)' | |
Finished in 2.56 seconds | |
6 examples, 2 failures | |
Failed examples: | |
rspec ./nokogiri_java.rb:20 # MyNode should read/write attributes correctly | |
rspec ./nokogiri_java.rb:31 # MyNode2 should read/write attributes correctly | |
rspec nokogiri_java.rb 14.58s user 0.73s system 258% cpu 5.930 total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment