Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
spec your xml
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib bumps the version
spec Undo fat finger
.gitignore initial commit
.travis.yml Add travis control file
CHANGELOG.md Added a changelog.
Gemfile removed pry
Rakefile initial commit
license.txt
readme.md Add gem and travis badges to Readme
rspec-xml.gemspec Cleanup after merge

readme.md

rspec-xml

Gem Version Build Status

spec your xml

installation

# Gemfile
gem 'rspec-xml'

Usage

# some_spec.rb
"<something>else</something>".should have_xpath('/something')
"<something>else</something>".should have_xpath('/something').with_text('else')

"<something>else</something>".should_not have_xpath('/what')
"<something>else</something>".should_not have_xpath('/something').with_text('what')

Builder

xml = Nokogiri::XML::Builder.new do |xml|
        xml.send("inner", "stuff", "Country" => "USA", "City" => "New York")
      end.to_xml

xml.should have_xpath('//some_xml/inner').with_text('stuff').with_attr({"Country" => "USA", "City" =>"New York"})
Something went wrong with that request. Please try again.