nokofuzzi 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +34 -1
  3. data/spec/nokofuzzi_spec.rb +5 -1
  4. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc497826c8b4596ff1927646342c101a2dc26baf
4
- data.tar.gz: 4928ad9752a166ffc87b43b79078858f2a4ddee3
3
+ metadata.gz: b9056b793e5ae8f8aeb572116a36c28c3a62dd6a
4
+ data.tar.gz: 78517b99ddc75a08b9a6a58e6a759c81ffa094dc
5
5
  SHA512:
6
- metadata.gz: f9624350d8279d3ef6b8b3ceb2558871958d0b6071734e6bddb2441b5e7e5e6d84d0a41e09433d272001d3bb56f2947339cbeb185deedcf9893f1b93f64d830e
7
- data.tar.gz: e36cb2e4c796459d2dbcaa91d3fa5e284459353cd05779420ae7f3c4a9a2e11af83a11ef9649e298183a5815464cf2b146ff6484137993f8fd94e155595f0f97
6
+ metadata.gz: 7c5bd3d0a35ac09fb6394dfa08f453d05756f538a5856db1b1e0a8cf01ef88715af6fdf33865018be4d8841b09c2a6553cea40925f579934939747c11357acbc
7
+ data.tar.gz: dbe954673a6559956cbab8498dac4704416f804100738e5a716fd286de0d79d13111bc531905f4d798d1e15a33fbe159d68001005cf9b63d62db3aa1bfdef677
data/README.md CHANGED
@@ -1,4 +1,37 @@
1
1
  nokofuzzi
2
2
  =========
3
3
 
4
- Fuzz testing iterators for Nokogiri
4
+ Fuzz testing iterators and extensions for Nokogiri
5
+
6
+ # Installation
7
+
8
+ Add this to your Gemfile (in the test group) and run `bundle install`:
9
+
10
+ ``` ruby
11
+ gem 'nokofuzzi'
12
+ ```
13
+
14
+ # Usage
15
+
16
+ I have larger plans for methods to attach to the Nokogiri document, but for now there are two:
17
+
18
+ ## each_missing
19
+ `each_missing` sets up an "each" iterator that sends you the string xml that was removed, and the new xml string (both from Nokogiri::XML)
20
+
21
+ ``` ruby
22
+ existing_xml = Nokogiri::XML('/path/to/xml')
23
+
24
+ existing_xml.each_missing do |removed_xml, new_xml|
25
+ puts "String representation of the xml removed: #{removed_xml}"
26
+ puts "String representation of the modified xml #{new_xml}"
27
+ end
28
+ ```
29
+
30
+ ## without_xpath
31
+ `without_xpath` creates a duplicate of the receiver with all matches for the given xpath removed.
32
+
33
+ ``` ruby
34
+ modified_xml = Nokogiri::XML('<a><b></b><c><b></b></c></a>').without_xpath('//b')
35
+
36
+ puts modified_xml.to_xml # <?xml version="1.0"?><a><c/></a>
37
+ ```
@@ -5,10 +5,14 @@ describe Nokogiri::XML::Document do
5
5
  let(:source_xml) { Nokogiri::XML('<node><a><c></c></a><b><c></c></b></node>')}
6
6
  let(:expected_b_c_xml) { Nokogiri::XML('<node><a><c></c></a><b></b></node>') }
7
7
  let(:expected_c_xml) { Nokogiri::XML('<node><a></a><b></b></node>') }
8
+ let(:expected_b_xml) { Nokogiri::XML('<node><a><c></c></a></node>') }
8
9
  it "expects removing //b/c to remove the <c> node inside <b>" do
9
10
  expect(source_xml.without_xpath('//b/c').to_xml).to eq(expected_b_c_xml.to_xml)
10
11
  end
11
- it "expects removing //c to removed all <c> nodes" do
12
+ it "expects removing //c to remove all <c> nodes" do
13
+ expect(source_xml.without_xpath('//c').to_xml).to eq(expected_c_xml.to_xml)
14
+ end
15
+ it "expects removing //b to remove everything <b> node and below" do
12
16
  expect(source_xml.without_xpath('//c').to_xml).to eq(expected_c_xml.to_xml)
13
17
  end
14
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokofuzzi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Powell
@@ -44,7 +44,8 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '3.0'
47
- description: Monkey patch all the Nokogiri things
47
+ description: Monkey patches on Nokogiri::XML::Document for manipulation of documents
48
+ for tests
48
49
  email:
49
50
  - twilliampowell@gmail.com
50
51
  executables: []
@@ -82,7 +83,7 @@ rubyforge_project:
82
83
  rubygems_version: 2.2.2
83
84
  signing_key:
84
85
  specification_version: 4
85
- summary: Iterators for Nokogiri for fuzz testing of applications
86
+ summary: Iterators and methods for Nokogiri for fuzz testing of applications
86
87
  test_files:
87
88
  - spec/nokofuzzi_spec.rb
88
89
  has_rdoc: