Skip to content

Commit

Permalink
Merge pull request #20 from Eric-Guo/master
Browse files Browse the repository at this point in the history
Add require rspec/matchers in readme.
  • Loading branch information
mbklein committed Jun 17, 2014
2 parents 1743fca + 7616171 commit 7997d08
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions README.md
Expand Up @@ -81,17 +81,24 @@ nodes) should be ignored when comparing for equivalence. Defaults to `nil`. (U
EquivalentXml includes a custom matcher for RSpec (version >=1.2.4) that makes including XML
equivalencies in your spec tests a cinch!

Add below two line to `spec_helper.rb`:

```ruby
require 'rspec/matchers' # req by equivalent-xml custom matcher `be_equivalent_to`
require 'equivalent-xml'
```

Equivalency:

node_1.should be_equivalent_to(node_2)
node_1.should_not be_equivalent_to(node_2)
expect(node_1).to be_equivalent_to(node_2)
expect(node_1).not_to be_equivalent_to(node_2)

Chained modifiers:

node_1.should be_equivalent_to(node_2).respecting_element_order
node_1.should be_equivalent_to(node_2).with_whitespace_intact
node_1.should be_equivalent_to(node_2).respecting_element_order.with_whitespace_intact
node_1.should be_equivalent_to(node_2).ignoring_content_of("SerialNumber")
expect(node_1).to be_equivalent_to(node_2).respecting_element_order
expect(node_1).to be_equivalent_to(node_2).with_whitespace_intact
expect(node_1).to be_equivalent_to(node_2).respecting_element_order.with_whitespace_intact
expect(node_1).to be_equivalent_to(node_2).ignoring_content_of("SerialNumber")

## Contributing to equivalent-xml

Expand Down

0 comments on commit 7997d08

Please sign in to comment.