geoffgarside-demolisher 0.0.1 → 0.1.0

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.1.0
data/demolisher.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{demolisher}
5
- s.version = "0.0.1"
5
+ s.version = "0.1.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Geoff Garside"]
@@ -22,12 +22,13 @@ Gem::Specification.new do |s|
22
22
  "demolisher.gemspec",
23
23
  "lib/demolisher.rb",
24
24
  "test/demolisher_test.rb",
25
+ "test/test.xml",
25
26
  "test/test_helper.rb"
26
27
  ]
27
28
  s.homepage = %q{http://github.com/geoffgarside/demolisher}
28
29
  s.rdoc_options = ["--charset=UTF-8"]
29
30
  s.require_paths = ["lib"]
30
- s.rubygems_version = %q{1.3.3}
31
+ s.rubygems_version = %q{1.3.4}
31
32
  s.summary = %q{Gem for extracting information from XML files, think Builder but backwards}
32
33
  s.test_files = [
33
34
  "test/demolisher_test.rb",
@@ -1,7 +1,50 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class DemolisherTest < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
4
+ context "Demolished XML file" do
5
+ setup do
6
+ @people = Array.new
7
+ xml = Demolisher.demolish(File.dirname(__FILE__) +'/test.xml')
8
+ xml.addressbook do
9
+ xml.person do
10
+ @people << {:firstname => xml.firstname.to_s, :lastname => xml.lastname.to_s,
11
+ :active => xml.active?, :email => xml.contact.email.to_s}
12
+ end
13
+ end
14
+ end
15
+ context "first extracted person" do
16
+ setup do
17
+ @person = @people[0]
18
+ end
19
+ should "have extracted firstname" do
20
+ assert_equal 'Enoch', @person[:firstname]
21
+ end
22
+ should "have extracted lastname" do
23
+ assert_equal 'Root', @person[:lastname]
24
+ end
25
+ should "have extracted true active status" do
26
+ assert @person[:active]
27
+ end
28
+ should "have extracted email" do
29
+ assert_equal 'enoch@example.com', @person[:email]
30
+ end
31
+ end
32
+ context "second extracted person" do
33
+ setup do
34
+ @person = @people[1]
35
+ end
36
+ should "have extracted firstname" do
37
+ assert_equal 'Randy', @person[:firstname]
38
+ end
39
+ should "have extracted lastname" do
40
+ assert_equal 'Waterhouse', @person[:lastname]
41
+ end
42
+ should "have extracted false active status" do
43
+ assert !@person[:active]
44
+ end
45
+ should "have extracted email" do
46
+ assert_equal 'randy@example.com', @person[:email]
47
+ end
48
+ end
6
49
  end
7
50
  end
data/test/test.xml ADDED
@@ -0,0 +1,20 @@
1
+ <addressbook>
2
+ <person>
3
+ <firstname>Enoch</firstname>
4
+ <lastname>Root</lastname>
5
+ <contact>
6
+ <phone>01234 567 8900</phone>
7
+ <email>enoch@example.com</email>
8
+ </contact>
9
+ <active>YES</active>
10
+ </person>
11
+ <person>
12
+ <firstname>Randy</firstname>
13
+ <lastname>Waterhouse</lastname>
14
+ <contact>
15
+ <phone>01234 567 8901</phone>
16
+ <email>randy@example.com</email>
17
+ </contact>
18
+ <active>NO</active>
19
+ </person>
20
+ </addressbook>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoffgarside-demolisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoff Garside
@@ -41,6 +41,7 @@ files:
41
41
  - demolisher.gemspec
42
42
  - lib/demolisher.rb
43
43
  - test/demolisher_test.rb
44
+ - test/test.xml
44
45
  - test/test_helper.rb
45
46
  has_rdoc: false
46
47
  homepage: http://github.com/geoffgarside/demolisher