outright/happymapper — pull request #1 by benash (2012-05-29 19:11:31+00:00)
Title: Spec fixes

All tests pass:

benash@macbook ~/code/happymapper (spec_fixes)$ rake [jruby-1.6.7]
/Users/benash/.rvm/rubies/jruby-1.6.7/bin/jruby -S rspec ./spec/happymapper_attribute_spec.rb ./spec/happymapper_element_spec.rb ./spec/happymapper_item_spec.rb ./spec/happymapper_spec.rb ./spec/happymapper_text_node_spec.rb ./spec/happymapper_to_xml_namespaces_spec.rb ./spec/happymapper_to_xml_spec.rb ./spec/ignay_spec.rb ./spec/xpath_spec.rb -c --format d

HappyMapper::Attribute
initialization
should know that it is an attribute
should know that it is NOT an element
should know that it is NOT a text node

HappyMapper::Element
initialization
should know that it is an element
should know that it is NOT an attribute
should know that it is NOT a text node

HappyMapper::Item
new instance
should accept a name
should accept a type
should accept :tag as an option
should have a method_name
#constant
should just use type if constant
should convert string type to constant
should convert string with :: to constant
#method_name
should convert dashes to underscores
#xpath
should default to tag
should prepend with .// if options[:deep] true
should prepend namespace if namespace exists
typecasting
should work with Strings
should work with Integers
should work with Floats
should work with Times
should work with Dates
should work with DateTimes
should work with Boolean

HappyMapper
should parse xml attributes into ruby objects
should parse xml elements to ruby objcts
should parse xml containing the desired element as root node
should parse text node correctly
should parse xml with default namespace (amazon)
should parse xml that has attributes of elements
parses xml with attributes of elements that aren't :single => true
should parse xml with nested elements
should parse xml with element name different to class name
should parse xml that has elements with dashes
should parse xml with no namespace
should parse xml with default namespace
should parse xml with single namespace
should parse xml with multiple namespaces
should be able to parse google analytics api xml
should be able to parse google analytics profile xml with manually declared namespace
should allow instantiating with a string
should parse family search xml
should parse multiple images
should parse lastfm namespaces
should parse ambigous items
being included into another class
should set attributes to an array
should set @elements to a hash
should allow adding an attribute
should allow adding an attribute containing a dash
should be able to get all attributes in array
should allow adding an element
should allow adding an element containing a dash
should be able to get all elements in array
should allow has one association
should allow has many association
should default tag name to lowercase class
should default tag name of class in modules to the last constant lowercase
should allow setting tag name
should allow setting a namespace
should provide #parse
#attributes
should only return attributes for the current class
#elements
should only return elements for the current class
Parse optional attributes
should parse an empty String as empty
should parse a String with value
should parse a String with value
Xml Content
should parse XmlContent
should save object's xml content
Article
should parse the publish options for Article and Photo
should parse the publish options for Article
should parse the publish options for Photo
should only find only items at the parent level
Namespace is missing because an optional element that uses it is not present
should parse successfully
with limit option
should return results with limited size: 6
should return results with limited size: 10

HappyMapper::Attribute
initialization
should know that it is a text node
should know that it is NOT an element
should know that it is NOT an attribute

HappyMapper
#to_xml with namespaces
should save elements
should save the element with the result of a function call and not the value of the instance variable
should save attributes
should save elements defined with the 'has_many' relationship
state_when_nil options
should save an empty element
on_save option
should save the result of the lambda
should save the result of a method
class types that also include HappyMapper mappings
should save attributes
should save elements
#to_xml with a default namespace
should write the default namespace to xml without repeating xmlns

HappyMapper
#to_xml
should save elements
should save the element with the result of a function call and not the value of the instance variable
should not save elements marked as read_only
should save attribues
should not save attributes marked as read_only
should save elements defined with the 'has_many' relationship
state_when_nil option
should save an empty element
on_save option
should save the result of the lambda
should save the result of a method
class types that also contain HappyMapper mappings
should save attributes
should save elements
should save elements

HappyMapper
should not be nil
should have the attribute code
should have many nodes
first node
should have a name
should have translations
should have subnodes
first node - first node name

HappyMapper
should have a title
should find the link href value
should find the link href value
should find this subitem based on the xpath
should find the subitems based on the xpath
should find the subitems based on the xpath
should find the subitems based on the xpath
should have a baby name

Finished in 1.7 seconds
114 examples, 0 failures