spec/happymapper_spec.rb in nokogiri-happymapper-0.5.6 vs spec/happymapper_spec.rb in nokogiri-happymapper-0.5.7
- old
+ new
@@ -1,8 +1,6 @@
-require File.dirname(__FILE__) + '/spec_helper.rb'
-require 'pp'
-require 'uri'
+require 'spec_helper'
module Analytics
class Property
include HappyMapper
@@ -280,10 +278,12 @@
end
class Status
include HappyMapper
+ register_namespace 'fake', "faka:namespace"
+
element :id, Integer
element :text, String
element :created_at, Time
element :source, String
element :truncated, Boolean
@@ -551,16 +551,18 @@
include HappyMapper
register_namespace 'bk', "urn:loc.gov:books"
register_namespace 'isbn', "urn:ISBN:0-395-36341-6"
+ register_namespace 'p', "urn:loc.gov:people"
namespace 'bk'
tag 'book'
element :title, String, :namespace => 'bk', :tag => "title"
element :number, String, :namespace => 'isbn', :tag => "number"
+ element :author, String, :namespace => 'p', :tag => "author"
end
describe HappyMapper do
describe "being included into another class" do
@@ -968,9 +970,13 @@
describe "Default namespace combi" do
before(:each) do
file_contents = fixture_file('default_namespace_combi.xml')
@book = DefaultNamespaceCombi.parse(file_contents, :single => true)
+ end
+
+ it "should parse author" do
+ @book.author.should == "Frank Gilbreth"
end
it "should parse title" do
@book.title.should == "Cheaper by the Dozen"
end