dm-types 0.10.2 → 1.0.0.rc1

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 (58) hide show
  1. data/.gitignore +36 -0
  2. data/Gemfile +147 -0
  3. data/Rakefile +7 -8
  4. data/VERSION +1 -1
  5. data/dm-types.gemspec +61 -20
  6. data/lib/dm-types.rb +24 -19
  7. data/lib/dm-types/bcrypt_hash.rb +17 -13
  8. data/lib/dm-types/comma_separated_list.rb +11 -16
  9. data/lib/dm-types/csv.rb +11 -11
  10. data/lib/dm-types/enum.rb +33 -50
  11. data/lib/dm-types/epoch_time.rb +11 -11
  12. data/lib/dm-types/file_path.rb +13 -10
  13. data/lib/dm-types/flag.rb +17 -25
  14. data/lib/dm-types/ip_address.rb +15 -11
  15. data/lib/dm-types/json.rb +17 -14
  16. data/lib/dm-types/paranoid/base.rb +38 -0
  17. data/lib/dm-types/paranoid_boolean.rb +23 -0
  18. data/lib/dm-types/paranoid_datetime.rb +22 -0
  19. data/lib/dm-types/regexp.rb +8 -8
  20. data/lib/dm-types/slug.rb +7 -12
  21. data/lib/dm-types/uri.rb +21 -9
  22. data/lib/dm-types/uuid.rb +18 -11
  23. data/lib/dm-types/yaml.rb +12 -10
  24. data/spec/fixtures/article.rb +0 -2
  25. data/spec/fixtures/bookmark.rb +0 -2
  26. data/spec/fixtures/network_node.rb +0 -2
  27. data/spec/fixtures/person.rb +0 -2
  28. data/spec/fixtures/software_package.rb +0 -2
  29. data/spec/fixtures/ticket.rb +2 -4
  30. data/spec/fixtures/tshirt.rb +3 -5
  31. data/spec/integration/bcrypt_hash_spec.rb +33 -31
  32. data/spec/integration/comma_separated_list_spec.rb +55 -53
  33. data/spec/integration/enum_spec.rb +55 -53
  34. data/spec/integration/file_path_spec.rb +105 -103
  35. data/spec/integration/flag_spec.rb +42 -40
  36. data/spec/integration/ip_address_spec.rb +91 -89
  37. data/spec/integration/json_spec.rb +41 -39
  38. data/spec/integration/slug_spec.rb +36 -34
  39. data/spec/integration/uri_spec.rb +82 -79
  40. data/spec/integration/uuid_spec.rb +63 -61
  41. data/spec/integration/yaml_spec.rb +37 -35
  42. data/spec/spec_helper.rb +7 -36
  43. data/spec/unit/bcrypt_hash_spec.rb +18 -10
  44. data/spec/unit/csv_spec.rb +92 -80
  45. data/spec/unit/enum_spec.rb +27 -42
  46. data/spec/unit/epoch_time_spec.rb +18 -7
  47. data/spec/unit/file_path_spec.rb +15 -10
  48. data/spec/unit/flag_spec.rb +13 -36
  49. data/spec/unit/ip_address_spec.rb +13 -10
  50. data/spec/unit/json_spec.rb +21 -14
  51. data/spec/unit/paranoid_boolean_spec.rb +138 -0
  52. data/spec/unit/paranoid_datetime_spec.rb +143 -0
  53. data/spec/unit/regexp_spec.rb +15 -5
  54. data/spec/unit/uri_spec.rb +13 -9
  55. data/spec/unit/yaml_spec.rb +16 -9
  56. data/tasks/local_gemfile.rake +18 -0
  57. data/tasks/spec.rake +0 -3
  58. metadata +122 -52
@@ -5,94 +5,96 @@ try_spec do
5
5
  require './spec/fixtures/network_node'
6
6
 
7
7
  describe DataMapper::Types::Fixtures::NetworkNode do
8
- describe 'with UUID set as UUID object' do
9
- before :all do
10
- @uuid_string = 'b0fc632e-d744-4821-afe3-4ea0701859ee'
11
- @uuid = UUIDTools::UUID.parse(@uuid_string)
12
- @resource = DataMapper::Types::Fixtures::NetworkNode.new(:uuid => @uuid)
13
-
14
- @resource.save.should be_true
15
- end
16
-
17
- describe 'when reloaded' do
8
+ supported_by :all do
9
+ describe 'with UUID set as UUID object' do
18
10
  before :all do
19
- @resource.reload
20
- end
11
+ @uuid_string = 'b0fc632e-d744-4821-afe3-4ea0701859ee'
12
+ @uuid = UUIDTools::UUID.parse(@uuid_string)
13
+ @resource = DataMapper::Types::Fixtures::NetworkNode.new(:uuid => @uuid)
21
14
 
22
- it 'has the same UUID string' do
23
- @resource.uuid.to_s.should == @uuid_string
15
+ @resource.save.should be_true
24
16
  end
25
17
 
26
- it 'returns UUID as an object' do
27
- @resource.uuid.should be_an_instance_of(UUIDTools::UUID)
28
- end
29
- end
30
- end
18
+ describe 'when reloaded' do
19
+ before :all do
20
+ @resource.reload
21
+ end
22
+
23
+ it 'has the same UUID string' do
24
+ @resource.uuid.to_s.should == @uuid_string
25
+ end
31
26
 
32
- describe 'with UUID set as a valid UUID string' do
33
- before :all do
34
- @uuid = 'b0fc632e-d744-4821-afe3-4ea0701859ee'
35
- @resource = DataMapper::Types::Fixtures::NetworkNode.new(:uuid => @uuid)
27
+ it 'returns UUID as an object' do
28
+ @resource.uuid.should be_an_instance_of(UUIDTools::UUID)
29
+ end
30
+ end
36
31
  end
37
32
 
38
- describe 'when reloaded' do
33
+ describe 'with UUID set as a valid UUID string' do
39
34
  before :all do
40
- @resource.reload
35
+ @uuid = 'b0fc632e-d744-4821-afe3-4ea0701859ee'
36
+ @resource = DataMapper::Types::Fixtures::NetworkNode.new(:uuid => @uuid)
41
37
  end
42
38
 
43
- it 'has the same UUID string' do
44
- @resource.uuid.to_s.should == @uuid
45
- end
39
+ describe 'when reloaded' do
40
+ before :all do
41
+ @resource.reload
42
+ end
46
43
 
47
- it 'returns UUID as an object' do
48
- @resource.uuid.should be_an_instance_of(UUIDTools::UUID)
49
- end
50
- end
51
- end
44
+ it 'has the same UUID string' do
45
+ @resource.uuid.to_s.should == @uuid
46
+ end
52
47
 
53
- describe 'with UUID set as invalid UUID string' do
54
- before :all do
55
- @uuid = 'meh'
56
- @operation = lambda do
57
- DataMapper::Types::Fixtures::NetworkNode.new(:uuid => @uuid)
48
+ it 'returns UUID as an object' do
49
+ @resource.uuid.should be_an_instance_of(UUIDTools::UUID)
50
+ end
58
51
  end
59
52
  end
60
53
 
61
- describe 'when assigned UUID' do
62
- it 'raises ArgumentError' do
63
- @operation.should raise_error(ArgumentError, /Invalid UUID format/)
54
+ describe 'with UUID set as invalid UUID string' do
55
+ before :all do
56
+ @uuid = 'meh'
57
+ @operation = lambda do
58
+ DataMapper::Types::Fixtures::NetworkNode.new(:uuid => @uuid)
59
+ end
64
60
  end
65
- end
66
- end
67
61
 
68
- describe 'with UUID set as a blank string' do
69
- before :all do
70
- @uuid = ''
71
- @operation = lambda do
72
- DataMapper::Types::Fixtures::NetworkNode.new(:uuid => @uuid)
62
+ describe 'when assigned UUID' do
63
+ it 'raises ArgumentError' do
64
+ @operation.should raise_error(ArgumentError, /Invalid UUID format/)
65
+ end
73
66
  end
74
67
  end
75
68
 
76
- describe 'when assigned UUID' do
77
- it 'raises ArgumentError' do
78
- @operation.should raise_error(ArgumentError, /Invalid UUID format/)
69
+ describe 'with UUID set as a blank string' do
70
+ before :all do
71
+ @uuid = ''
72
+ @operation = lambda do
73
+ DataMapper::Types::Fixtures::NetworkNode.new(:uuid => @uuid)
74
+ end
79
75
  end
80
- end
81
- end
82
76
 
83
- describe 'with missing UUID' do
84
- before :all do
85
- @uuid = nil
86
- @resource = DataMapper::Types::Fixtures::NetworkNode.new(:uuid => @uuid)
77
+ describe 'when assigned UUID' do
78
+ it 'raises ArgumentError' do
79
+ @operation.should raise_error(ArgumentError, /Invalid UUID format/)
80
+ end
81
+ end
87
82
  end
88
83
 
89
- describe 'when reloaded' do
84
+ describe 'with missing UUID' do
90
85
  before :all do
91
- @resource.reload
86
+ @uuid = nil
87
+ @resource = DataMapper::Types::Fixtures::NetworkNode.new(:uuid => @uuid)
92
88
  end
93
89
 
94
- it 'has no UUID' do
95
- @resource.uuid.should be_nil
90
+ describe 'when reloaded' do
91
+ before :all do
92
+ @resource.reload
93
+ end
94
+
95
+ it 'has no UUID' do
96
+ @resource.uuid.should be_nil
97
+ end
96
98
  end
97
99
  end
98
100
  end
@@ -6,60 +6,62 @@ try_spec do
6
6
  require './spec/fixtures/invention'
7
7
 
8
8
  describe DataMapper::Types::Fixtures::Person do
9
- before :all do
10
- @resource = DataMapper::Types::Fixtures::Person.new(:name => '')
11
- end
12
-
13
- describe 'with no inventions information' do
9
+ supported_by :all do
14
10
  before :all do
15
- @resource.inventions = nil
11
+ @resource = DataMapper::Types::Fixtures::Person.new(:name => '')
16
12
  end
17
13
 
18
- describe 'when dumped and loaded again' do
14
+ describe 'with no inventions information' do
19
15
  before :all do
20
- @resource.save.should be_true
21
- @resource.reload
16
+ @resource.inventions = nil
22
17
  end
23
18
 
24
- it 'has nil inventions list' do
25
- @resource.inventions.should be_nil
26
- end
27
- end
28
- end
19
+ describe 'when dumped and loaded again' do
20
+ before :all do
21
+ @resource.save.should be_true
22
+ @resource.reload
23
+ end
29
24
 
30
- describe 'with a few items on the inventions list' do
31
- before :all do
32
- @input = [ 'carbon telephone transmitter', 'light bulb', 'electric grid' ].map do |name|
33
- DataMapper::Types::Fixtures::Invention.new(name)
25
+ it 'has nil inventions list' do
26
+ @resource.inventions.should be_nil
27
+ end
34
28
  end
35
- @resource.inventions = @input
36
29
  end
37
30
 
38
- describe 'when dumped and loaded again' do
31
+ describe 'with a few items on the inventions list' do
39
32
  before :all do
40
- @resource.save.should be_true
41
- @resource.reload
33
+ @input = [ 'carbon telephone transmitter', 'light bulb', 'electric grid' ].map do |name|
34
+ DataMapper::Types::Fixtures::Invention.new(name)
35
+ end
36
+ @resource.inventions = @input
42
37
  end
43
38
 
44
- it 'loads inventions list to the state when it was dumped/persisted with keys being strings' do
45
- @resource.inventions.should == @input
46
- end
47
- end
48
- end
39
+ describe 'when dumped and loaded again' do
40
+ before :all do
41
+ @resource.save.should be_true
42
+ @resource.reload
43
+ end
49
44
 
50
- describe 'with inventions information given as empty list' do
51
- before :all do
52
- @resource.inventions = []
45
+ it 'loads inventions list to the state when it was dumped/persisted with keys being strings' do
46
+ @resource.inventions.should == @input
47
+ end
48
+ end
53
49
  end
54
50
 
55
- describe 'when dumped and loaded again' do
51
+ describe 'with inventions information given as empty list' do
56
52
  before :all do
57
- @resource.save.should be_true
58
- @resource.reload
53
+ @resource.inventions = []
59
54
  end
60
55
 
61
- it 'has empty inventions list' do
62
- @resource.inventions.should == []
56
+ describe 'when dumped and loaded again' do
57
+ before :all do
58
+ @resource.save.should be_true
59
+ @resource.reload
60
+ end
61
+
62
+ it 'has empty inventions list' do
63
+ @resource.inventions.should == []
64
+ end
63
65
  end
64
66
  end
65
67
  end
@@ -1,45 +1,16 @@
1
- require 'rubygems'
2
-
3
- # TODO: autovalidation hooks are needed badly,
4
- # otherwise plugin devs will have to abuse
5
- # alising and load order even further and it kinda makes
6
- # me sad -- MK
7
-
8
- # use local dm-core if running from a typical dev checkout.
9
- lib = File.join('..', '..', 'dm-core', 'lib')
10
- $LOAD_PATH.unshift(lib) if File.directory?(lib)
11
- require 'dm-core'
12
-
13
- # use local dm-validations if running from a typical dev checkout.
14
- lib = File.join('..', 'dm-validations', 'lib')
15
- $LOAD_PATH.unshift(lib) if File.directory?(lib)
16
- require 'dm-validations'
17
-
18
- # Support running specs with 'rake spec' and 'spec'
19
- $LOAD_PATH.unshift('lib') unless $LOAD_PATH.include?('lib')
1
+ require 'dm-core/spec/setup'
2
+ require 'dm-core/spec/lib/adapter_helpers'
20
3
 
21
4
  require 'dm-types'
5
+ require 'dm-migrations'
6
+ require 'dm-validations'
22
7
 
23
- def load_driver(name, default_uri)
24
- return false if ENV['ADAPTER'] != name.to_s
8
+ DataMapper::Spec.setup
25
9
 
26
- begin
27
- DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri)
28
- DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name]
29
- true
30
- rescue LoadError => e
31
- warn "Could not load do_#{name}: #{e}"
32
- false
33
- end
10
+ Spec::Runner.configure do |config|
11
+ config.extend(DataMapper::Spec::Adapters::Helpers)
34
12
  end
35
13
 
36
- ENV['ADAPTER'] ||= 'sqlite3'
37
-
38
- HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:')
39
- HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test')
40
- HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test')
41
-
42
-
43
14
  DEPENDENCIES = {
44
15
  'bcrypt' => 'bcrypt-ruby',
45
16
  }
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  try_spec do
4
- describe DataMapper::Types::BCryptHash do
4
+ describe DataMapper::Property::BCryptHash do
5
5
  before :all do
6
6
  @clear_password = 'DataMapper R0cks!'
7
7
  @crypted_password = BCrypt::Password.create(@clear_password)
@@ -13,13 +13,21 @@ try_spec do
13
13
  @b = 'Hi There'
14
14
  end
15
15
  @nonstandard_type2 = TestType.new
16
+
17
+ class User
18
+ include DataMapper::Resource
19
+ property :id, Serial
20
+ property :password, BCryptHash
21
+ end
22
+
23
+ @bcrypt_hash = User.properties[:password]
16
24
  end
17
25
 
18
26
  describe '.dump' do
19
27
  describe 'when argument is a string' do
20
28
  before :all do
21
29
  @input = 'DataMapper'
22
- @result = DataMapper::Types::BCryptHash.dump(@input, :property)
30
+ @result = @bcrypt_hash.dump(@input)
23
31
  end
24
32
 
25
33
  it 'returns instance of BCrypt::Password' do
@@ -34,7 +42,7 @@ try_spec do
34
42
  describe 'when argument is nil' do
35
43
  before :all do
36
44
  @input = nil
37
- @result = DataMapper::Types::BCryptHash.dump(@input, :property)
45
+ @result = @bcrypt_hash.dump(@input)
38
46
  end
39
47
 
40
48
  it 'returns nil' do
@@ -47,7 +55,7 @@ try_spec do
47
55
  describe 'when argument is a string' do
48
56
  before :all do
49
57
  @input = 'DataMapper'
50
- @result = DataMapper::Types::BCryptHash.load(@crypted_password, :property)
58
+ @result = @bcrypt_hash.load(@crypted_password)
51
59
  end
52
60
 
53
61
  it 'returns instance of BCrypt::Password' do
@@ -62,7 +70,7 @@ try_spec do
62
70
  describe 'when argument is nil' do
63
71
  before :all do
64
72
  @input = nil
65
- @result = DataMapper::Types::BCryptHash.load(@input, :property)
73
+ @result = @bcrypt_hash.load(@input)
66
74
  end
67
75
 
68
76
  it 'returns nil' do
@@ -75,7 +83,7 @@ try_spec do
75
83
  describe 'when argument is a string' do
76
84
  before :all do
77
85
  @input = 'bcrypt hash'
78
- @result = DataMapper::Types::BCryptHash.typecast(@input, :property)
86
+ @result = @bcrypt_hash.typecast(@input)
79
87
  end
80
88
 
81
89
  it 'casts argument to BCrypt::Password' do
@@ -90,7 +98,7 @@ try_spec do
90
98
  describe 'when argument is a blank string' do
91
99
  before :all do
92
100
  @input = ''
93
- @result = DataMapper::Types::BCryptHash.typecast(@input, :property)
101
+ @result = @bcrypt_hash.typecast(@input)
94
102
  end
95
103
 
96
104
  it 'casts argument to BCrypt::Password' do
@@ -105,7 +113,7 @@ try_spec do
105
113
  describe 'when argument is integer' do
106
114
  before :all do
107
115
  @input = 2249
108
- @result = DataMapper::Types::BCryptHash.typecast(@input, :property)
116
+ @result = @bcrypt_hash.typecast(@input)
109
117
  end
110
118
 
111
119
  it 'casts argument to BCrypt::Password' do
@@ -120,7 +128,7 @@ try_spec do
120
128
  describe 'when argument is hash' do
121
129
  before :all do
122
130
  @input = { :cryptic => 'obscure' }
123
- @result = DataMapper::Types::BCryptHash.typecast(@input, :property)
131
+ @result = @bcrypt_hash.typecast(@input)
124
132
  end
125
133
 
126
134
  it 'casts argument to BCrypt::Password' do
@@ -135,7 +143,7 @@ try_spec do
135
143
  describe 'when argument is nil' do
136
144
  before :all do
137
145
  @input = nil
138
- @result = DataMapper::Types::BCryptHash.typecast(@input, :property)
146
+ @result = @bcrypt_hash.typecast(@input)
139
147
  end
140
148
 
141
149
  it 'returns nil' do
@@ -1,117 +1,129 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  try_spec do
4
- describe DataMapper::Types::Csv do
5
- describe '.load' do
6
- describe 'when argument is a comma separated string' do
7
- before :all do
8
- @input = 'uno,due,tre'
9
- @result = DataMapper::Types::Csv.load(@input, :property)
4
+ describe DataMapper::Property::Csv do
5
+ supported_by :all do
6
+ before :all do
7
+ class User
8
+ include DataMapper::Resource
9
+ property :id, Serial
10
+ property :things, Csv
10
11
  end
11
12
 
12
- it 'parses the argument using CVS parser' do
13
- @result.should == [ %w[ uno due tre ] ]
14
- end
13
+ @property = User.properties[:things]
15
14
  end
16
15
 
17
- describe 'when argument is an empty array' do
18
- before :all do
19
- @input = []
20
- @result = DataMapper::Types::Csv.load(@input, :property)
21
- end
16
+ describe '.load' do
17
+ describe 'when argument is a comma separated string' do
18
+ before :all do
19
+ @input = 'uno,due,tre'
20
+ @result = @property.load(@input)
21
+ end
22
22
 
23
- it 'does not change the input' do
24
- @result.should == @input
23
+ it 'parses the argument using CVS parser' do
24
+ @result.should == [ %w[ uno due tre ] ]
25
+ end
25
26
  end
26
- end
27
27
 
28
- describe 'when argument is an empty hash' do
29
- before :all do
30
- @input = {}
31
- @result = DataMapper::Types::Csv.load(@input, :property)
32
- end
28
+ describe 'when argument is an empty array' do
29
+ before :all do
30
+ @input = []
31
+ @result = @property.load(@input)
32
+ end
33
33
 
34
- it 'returns nil' do
35
- @result.should be_nil
34
+ it 'does not change the input' do
35
+ @result.should == @input
36
+ end
36
37
  end
37
- end
38
38
 
39
- describe 'when argument is nil' do
40
- before :all do
41
- @input = nil
42
- @result = DataMapper::Types::Csv.load(@input, :property)
43
- end
39
+ describe 'when argument is an empty hash' do
40
+ before :all do
41
+ @input = {}
42
+ @result = @property.load(@input)
43
+ end
44
44
 
45
- it 'returns nil' do
46
- @result.should be_nil
45
+ it 'returns nil' do
46
+ @result.should be_nil
47
+ end
47
48
  end
48
- end
49
49
 
50
- describe 'when argument is an integer' do
51
- before :all do
52
- @input = 7
53
- @result = DataMapper::Types::Csv.load(@input, :property)
54
- end
50
+ describe 'when argument is nil' do
51
+ before :all do
52
+ @input = nil
53
+ @result = @property.load(@input)
54
+ end
55
55
 
56
- it 'returns nil' do
57
- @result.should be_nil
56
+ it 'returns nil' do
57
+ @result.should be_nil
58
+ end
58
59
  end
59
- end
60
60
 
61
- describe 'when argument is a float' do
62
- before :all do
63
- @input = 7.0
64
- @result = DataMapper::Types::Csv.load(@input, :property)
65
- end
61
+ describe 'when argument is an integer' do
62
+ before :all do
63
+ @input = 7
64
+ @result = @property.load(@input)
65
+ end
66
66
 
67
- it 'returns nil' do
68
- @result.should be_nil
67
+ it 'returns nil' do
68
+ @result.should be_nil
69
+ end
69
70
  end
70
- end
71
- end
72
71
 
73
- describe '.dump' do
74
- describe 'when value is a list of lists' do
75
- before :all do
76
- @input = [ %w[ uno due tre ], %w[ uno dos tres ] ]
77
- @result = DataMapper::Types::Csv.dump(@input, :property)
78
- end
72
+ describe 'when argument is a float' do
73
+ before :all do
74
+ @input = 7.0
75
+ @result = @property.load(@input)
76
+ end
79
77
 
80
- it 'dumps value to comma separated string' do
81
- @result.should == "uno,due,tre\nuno,dos,tres\n"
78
+ it 'returns nil' do
79
+ @result.should be_nil
80
+ end
82
81
  end
83
82
  end
84
83
 
85
- describe 'when value is a string' do
86
- before :all do
87
- @input = 'beauty hides in the deep'
88
- @result = DataMapper::Types::Csv.dump(@input, :property)
89
- end
84
+ describe '.dump' do
85
+ describe 'when value is a list of lists' do
86
+ before :all do
87
+ @input = [ %w[ uno due tre ], %w[ uno dos tres ] ]
88
+ @result = @property.dump(@input)
89
+ end
90
90
 
91
- it 'returns input as is' do
92
- @result.should == @input
91
+ it 'dumps value to comma separated string' do
92
+ @result.should == "uno,due,tre\nuno,dos,tres\n"
93
+ end
93
94
  end
94
- end
95
95
 
96
- describe 'when value is nil' do
97
- before :all do
98
- @input = nil
99
- @result = DataMapper::Types::Csv.dump(@input, :property)
100
- end
96
+ describe 'when value is a string' do
97
+ before :all do
98
+ @input = 'beauty hides in the deep'
99
+ @result = @property.dump(@input)
100
+ end
101
101
 
102
- it 'returns nil' do
103
- @result.should be_nil
102
+ it 'returns input as is' do
103
+ @result.should == @input
104
+ end
104
105
  end
105
- end
106
106
 
107
- describe 'when value is a hash' do
108
- before :all do
109
- @input = { :library => 'DataMapper', :language => 'Ruby' }
110
- @result = DataMapper::Types::Csv.dump(@input, :property)
107
+ describe 'when value is nil' do
108
+ before :all do
109
+ @input = nil
110
+ @result = @property.dump(@input)
111
+ end
112
+
113
+ it 'returns nil' do
114
+ @result.should be_nil
115
+ end
111
116
  end
112
117
 
113
- it 'returns nil' do
114
- @result.should be_nil
118
+ describe 'when value is a hash' do
119
+ before :all do
120
+ @input = { :library => 'DataMapper', :language => 'Ruby' }
121
+ @result = @property.dump(@input)
122
+ end
123
+
124
+ it 'returns nil' do
125
+ @result.should be_nil
126
+ end
115
127
  end
116
128
  end
117
129
  end