Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update libxml dependency #17

Merged
merged 3 commits into from

3 participants

@ehutzelman

updated libxml-ruby to v2, updated spec_helper pathing for ruby 1.9, added gemfile

@kaluznyo

You can update libxml-ruby to version 2.2.X (and rspec, but I think more modification is require) And this can close issue #19...

@kaluznyo

Sorry it's already up-to-date for libxml-ruby...

@bkeepers bkeepers merged commit 79e8a95 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 25, 2011
  1. @ehutzelman

    update spec_helper pathing

    ehutzelman authored
  2. @ehutzelman
Commits on May 28, 2011
  1. @ehutzelman
This page is out of date. Refresh to see the latest.
View
8 Gemfile
@@ -0,0 +1,8 @@
+source :rubygems
+
+gemspec
+
+group :development do
+ gem 'rake'
+ gem "rspec", "~> 1.3"
+end
View
6 Rakefile
@@ -1,6 +1,8 @@
require 'rubygems'
+require 'bundler/setup'
+
require 'rake'
-require 'rake/rdoctask'
+require 'rdoc/task'
require 'spec/rake/spectask'
require File.expand_path('../lib/happymapper/version', __FILE__)
@@ -33,7 +35,7 @@ task :website do
sh %{rsync -av website/ jnunemaker@rubyforge.org:/var/www/gforge-projects/happymapper}
end
-Rake::RDocTask.new do |r|
+RDoc::Task.new do |r|
r.title = 'HappyMapper Docs'
r.main = 'README.rdoc'
r.rdoc_dir = 'doc'
View
3  happymapper.gemspec
@@ -14,6 +14,5 @@ Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.files = Dir.glob("{examples,lib,spec}/**/*") + %w[License Rakefile README.rdoc]
- s.add_dependency 'libxml-ruby', '~> 1.1.3'
- s.add_development_dependency 'rspec', '~> 1.3.0'
+ s.add_dependency 'libxml-ruby', '~> 2.0'
end
View
6 spec/happymapper_attribute_spec.rb
@@ -1,15 +1,15 @@
-require File.dirname(__FILE__) + '/spec_helper.rb'
+require 'spec_helper'
describe HappyMapper::Attribute do
describe "initialization" do
before do
@attr = HappyMapper::Attribute.new(:foo, String)
end
-
+
it 'should know that it is an attribute' do
@attr.attribute?.should be_true
end
-
+
it 'should know that it is NOT an element' do
@attr.element?.should be_false
end
View
6 spec/happymapper_element_spec.rb
@@ -1,15 +1,15 @@
-require File.dirname(__FILE__) + '/spec_helper.rb'
+require 'spec_helper'
describe HappyMapper::Element do
describe "initialization" do
before do
@attr = HappyMapper::Element.new(:foo, String)
end
-
+
it 'should know that it is an element' do
@attr.element?.should be_true
end
-
+
it 'should know that it is NOT an attribute' do
@attr.attribute?.should be_false
end
View
40 spec/happymapper_item_spec.rb
@@ -1,75 +1,75 @@
-require File.dirname(__FILE__) + '/spec_helper.rb'
+require 'spec_helper'
module Foo
class Bar; end
end
describe HappyMapper::Item do
-
+
describe "new instance" do
before do
@item = HappyMapper::Item.new(:foo, String, :tag => 'foobar')
end
-
+
it "should accept a name" do
@item.name.should == 'foo'
end
-
+
it 'should accept a type' do
@item.type.should == String
end
-
+
it 'should accept :tag as an option' do
@item.tag.should == 'foobar'
end
-
+
it "should have a method_name" do
@item.method_name.should == 'foo'
end
end
-
+
describe "#constant" do
it "should just use type if constant" do
item = HappyMapper::Item.new(:foo, String)
item.constant.should == String
end
-
+
it "should convert string type to constant" do
item = HappyMapper::Item.new(:foo, 'String')
item.constant.should == String
end
-
+
it "should convert string with :: to constant" do
item = HappyMapper::Item.new(:foo, 'Foo::Bar')
item.constant.should == Foo::Bar
end
end
-
+
describe "#method_name" do
it "should convert dashes to underscores" do
item = HappyMapper::Item.new(:'foo-bar', String, :tag => 'foobar')
item.method_name.should == 'foo_bar'
end
end
-
+
describe "#xpath" do
it "should default to tag" do
item = HappyMapper::Item.new(:foo, String, :tag => 'foobar')
item.xpath.should == 'foobar'
end
-
+
it "should prepend with .// if options[:deep] true" do
item = HappyMapper::Item.new(:foo, String, :tag => 'foobar', :deep => true)
item.xpath.should == './/foobar'
end
-
+
it "should prepend namespace if namespace exists" do
item = HappyMapper::Item.new(:foo, String, :tag => 'foobar')
item.namespace = 'http://example.com'
item.xpath.should == 'happymapper:foobar'
end
end
-
+
describe "typecasting" do
it "should work with Strings" do
item = HappyMapper::Item.new(:foo, String)
@@ -77,36 +77,36 @@ class Bar; end
item.typecast(a).should == '21'
end
end
-
+
it "should work with Integers" do
item = HappyMapper::Item.new(:foo, Integer)
[21, 21.0, '21'].each do |a|
item.typecast(a).should == 21
end
end
-
+
it "should work with Floats" do
item = HappyMapper::Item.new(:foo, Float)
[21, 21.0, '21'].each do |a|
item.typecast(a).should == 21.0
end
end
-
+
it "should work with Times" do
item = HappyMapper::Item.new(:foo, Time)
item.typecast('2000-01-01 01:01:01.123456').should == Time.local(2000, 1, 1, 1, 1, 1, 123456)
end
-
+
it "should work with Dates" do
item = HappyMapper::Item.new(:foo, Date)
item.typecast('2000-01-01').should == Date.new(2000, 1, 1)
end
-
+
it "should work with DateTimes" do
item = HappyMapper::Item.new(:foo, DateTime)
item.typecast('2000-01-01 00:00:00').should == DateTime.new(2000, 1, 1, 0, 0, 0)
end
-
+
it "should work with Boolean" do
item = HappyMapper::Item.new(:foo, Boolean)
item.typecast('false').should == false
View
4 spec/happymapper_spec.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/spec_helper.rb'
+require 'spec_helper'
require 'pp'
require 'uri'
require 'support/models'
@@ -172,7 +172,7 @@ module Bar; class Baz; include HappyMapper; end; end
address.city.should == 'Oldenburg'
address.country.should == 'Germany'
end
-
+
it "should parse xml containing a has many relationship with primitive types" do
address = MultiStreetAddress.parse(fixture_file('multi_street_address.xml'), :single => true)
address.should_not be_nil
View
3  spec/spec_helper.rb
@@ -1,3 +1,6 @@
+require 'rubygems'
+require 'bundler/setup'
+
require 'spec'
require File.expand_path('../../lib/happymapper', __FILE__)
Something went wrong with that request. Please try again.