Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

spec your xml

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 CHANGELOG.md
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 license.txt
Octocat-spinner-32 readme.md
Octocat-spinner-32 rspec-xml.gemspec
readme.md

rspec-xml

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 = ''
builder = Builder::XmlMarkup.new(:target => xml)
builder.instruct!

builder.some_xml do |xml|
  xml.inner 'stuff'
end

xml.should have_xpath('//some_xml/inner').with_text('stuff')
Something went wrong with that request. Please try again.