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
@@ -15,139 +15,141 @@ try_spec do
15
15
  require './spec/fixtures/network_node'
16
16
 
17
17
  describe DataMapper::Types::Fixtures::NetworkNode do
18
- before :all do
19
- @resource = DataMapper::Types::Fixtures::NetworkNode.new(
20
- :node_uuid => '25a44800-21c9-11de-8c30-0800200c9a66',
21
- :ip_address => nil,
22
- :cidr_subnet_bits => nil
23
- )
24
- end
25
-
26
- include IPAddressMatchers
27
-
28
- describe 'with IP address fe80::ab8:e8ff:fed7:f8c9' do
18
+ supported_by :all do
29
19
  before :all do
30
- @resource.ip_address = 'fe80::ab8:e8ff:fed7:f8c9'
20
+ @resource = DataMapper::Types::Fixtures::NetworkNode.new(
21
+ :node_uuid => '25a44800-21c9-11de-8c30-0800200c9a66',
22
+ :ip_address => nil,
23
+ :cidr_subnet_bits => nil
24
+ )
31
25
  end
32
26
 
33
- describe 'when dumped and loaded' do
27
+ include IPAddressMatchers
28
+
29
+ describe 'with IP address fe80::ab8:e8ff:fed7:f8c9' do
34
30
  before :all do
35
- @resource.save.should be_true
36
- @resource.reload
31
+ @resource.ip_address = 'fe80::ab8:e8ff:fed7:f8c9'
37
32
  end
38
33
 
39
- it 'is an IPv6 node' do
40
- @resource.should run_ipv6
41
- end
42
- end
43
- end
34
+ describe 'when dumped and loaded' do
35
+ before :all do
36
+ @resource.save.should be_true
37
+ @resource.reload
38
+ end
44
39
 
45
- describe 'with IP address 127.0.0.1' do
46
- before :all do
47
- @resource.ip_address = '127.0.0.1'
40
+ it 'is an IPv6 node' do
41
+ @resource.should run_ipv6
42
+ end
43
+ end
48
44
  end
49
45
 
50
- describe 'when dumped and loaded' do
46
+ describe 'with IP address 127.0.0.1' do
51
47
  before :all do
52
- @resource.save.should be_true
53
- @resource.reload
48
+ @resource.ip_address = '127.0.0.1'
54
49
  end
55
50
 
56
- it 'is an IPv4 node' do
57
- @resource.should run_ipv4
58
- end
59
- end
60
- end
51
+ describe 'when dumped and loaded' do
52
+ before :all do
53
+ @resource.save.should be_true
54
+ @resource.reload
55
+ end
61
56
 
62
- describe 'with IP address 218.43.243.136' do
63
- before :all do
64
- @resource.ip_address = '218.43.243.136'
57
+ it 'is an IPv4 node' do
58
+ @resource.should run_ipv4
59
+ end
60
+ end
65
61
  end
66
62
 
67
- describe 'when dumped and loaded' do
63
+ describe 'with IP address 218.43.243.136' do
68
64
  before :all do
69
- @resource.save.should be_true
70
- @resource.reload
65
+ @resource.ip_address = '218.43.243.136'
71
66
  end
72
67
 
73
- it 'is an IPv4 node' do
74
- @resource.should run_ipv4
75
- end
76
- end
77
- end
68
+ describe 'when dumped and loaded' do
69
+ before :all do
70
+ @resource.save.should be_true
71
+ @resource.reload
72
+ end
78
73
 
79
- describe 'with IP address 221.186.184.68' do
80
- before :all do
81
- @resource.ip_address = '221.186.184.68'
74
+ it 'is an IPv4 node' do
75
+ @resource.should run_ipv4
76
+ end
77
+ end
82
78
  end
83
79
 
84
- describe 'when dumped and loaded' do
80
+ describe 'with IP address 221.186.184.68' do
85
81
  before :all do
86
- @resource.save.should be_true
87
- @resource.reload
82
+ @resource.ip_address = '221.186.184.68'
88
83
  end
89
84
 
90
- it 'is an IPv4 node' do
91
- @resource.should run_ipv4
92
- end
93
- end
94
- end
85
+ describe 'when dumped and loaded' do
86
+ before :all do
87
+ @resource.save.should be_true
88
+ @resource.reload
89
+ end
95
90
 
96
- describe 'with IP address given as CIDR' do
97
- before :all do
98
- @resource.ip_address = '218.43.243.0/24'
91
+ it 'is an IPv4 node' do
92
+ @resource.should run_ipv4
93
+ end
94
+ end
99
95
  end
100
96
 
101
- describe 'when dumped and loaded' do
97
+ describe 'with IP address given as CIDR' do
102
98
  before :all do
103
- @resource.save.should be_true
104
- @resource.reload
99
+ @resource.ip_address = '218.43.243.0/24'
105
100
  end
106
101
 
107
- it 'is an IPv4 node' do
108
- @resource.should run_ipv4
109
- end
102
+ describe 'when dumped and loaded' do
103
+ before :all do
104
+ @resource.save.should be_true
105
+ @resource.reload
106
+ end
110
107
 
111
- it 'includes IP address 218.43.243.2 in subnet hosts' do
112
- @resource.ip_address.include?('218.43.243.2')
113
- end
114
- end
115
- end
108
+ it 'is an IPv4 node' do
109
+ @resource.should run_ipv4
110
+ end
116
111
 
117
- describe 'with a blank string used as IP address' do
118
- before :all do
119
- @resource.ip_address = ''
112
+ it 'includes IP address 218.43.243.2 in subnet hosts' do
113
+ @resource.ip_address.include?('218.43.243.2')
114
+ end
115
+ end
120
116
  end
121
117
 
122
- describe 'when dumped and loaded' do
118
+ describe 'with a blank string used as IP address' do
123
119
  before :all do
124
- @resource.save.should be_true
125
- @resource.reload
120
+ @resource.ip_address = ''
126
121
  end
127
122
 
128
- it 'is an IPv4 node' do
129
- @resource.should run_ipv4
130
- end
123
+ describe 'when dumped and loaded' do
124
+ before :all do
125
+ @resource.save.should be_true
126
+ @resource.reload
127
+ end
131
128
 
132
- it 'should be the expected value' do
133
- @resource.ip_address.should == IPAddr.new('0.0.0.0')
134
- end
135
- end
136
- end
129
+ it 'is an IPv4 node' do
130
+ @resource.should run_ipv4
131
+ end
137
132
 
138
- describe 'with NO IP address' do
139
- before :all do
140
- @resource.ip_address = nil
133
+ it 'should be the expected value' do
134
+ @resource.ip_address.should == IPAddr.new('0.0.0.0')
135
+ end
136
+ end
141
137
  end
142
138
 
143
- describe 'when dumped and loaded' do
139
+ describe 'with NO IP address' do
144
140
  before :all do
145
- @resource.save.should be_true
146
- @resource.reload
141
+ @resource.ip_address = nil
147
142
  end
148
143
 
149
- it 'has no IP address assigned' do
150
- @resource.ip_address.should be_nil
144
+ describe 'when dumped and loaded' do
145
+ before :all do
146
+ @resource.save.should be_true
147
+ @resource.reload
148
+ end
149
+
150
+ it 'has no IP address assigned' do
151
+ @resource.ip_address.should be_nil
152
+ end
151
153
  end
152
154
  end
153
155
  end
@@ -5,63 +5,65 @@ try_spec do
5
5
  require './spec/fixtures/person'
6
6
 
7
7
  describe DataMapper::Types::Fixtures::Person do
8
- before :all do
9
- @resource = DataMapper::Types::Fixtures::Person.new(:name => 'Thomas Edison')
10
- end
11
-
12
- describe 'with no positions information' do
8
+ supported_by :all do
13
9
  before :all do
14
- @resource.positions = nil
10
+ @resource = DataMapper::Types::Fixtures::Person.new(:name => 'Thomas Edison')
15
11
  end
16
12
 
17
- describe 'when dumped and loaded again' do
13
+ describe 'with no positions information' do
18
14
  before :all do
19
- @resource.save.should be_true
20
- @resource.reload
15
+ @resource.positions = nil
21
16
  end
22
17
 
23
- it 'has nil positions list' do
24
- @resource.positions.should be_nil
25
- end
26
- end
27
- end
18
+ describe 'when dumped and loaded again' do
19
+ before :all do
20
+ @resource.save.should be_true
21
+ @resource.reload
22
+ end
28
23
 
29
- describe 'with a few items on the positions list' do
30
- before :all do
31
- @resource.positions = [
32
- { :company => 'The Death Star, Inc', :title => 'Light sabre engineer' },
33
- { :company => 'Sane Little Company', :title => 'Chief Curiosity Officer' },
34
- ]
24
+ it 'has nil positions list' do
25
+ @resource.positions.should be_nil
26
+ end
27
+ end
35
28
  end
36
29
 
37
- describe 'when dumped and loaded again' do
30
+ describe 'with a few items on the positions list' do
38
31
  before :all do
39
- @resource.save.should be_true
40
- @resource.reload
41
- end
42
-
43
- it 'loads positions list to the state when it was dumped/persisted with keys being strings' do
44
- @resource.positions.should == [
45
- { 'company' => 'The Death Star, Inc', 'title' => 'Light sabre engineer' },
46
- { 'company' => 'Sane Little Company', 'title' => 'Chief Curiosity Officer' },
32
+ @resource.positions = [
33
+ { :company => 'The Death Star, Inc', :title => 'Light sabre engineer' },
34
+ { :company => 'Sane Little Company', :title => 'Chief Curiosity Officer' },
47
35
  ]
48
36
  end
49
- end
50
- end
51
37
 
52
- describe 'with positions information given as empty list' do
53
- before :all do
54
- @resource.positions = []
38
+ describe 'when dumped and loaded again' do
39
+ before :all do
40
+ @resource.save.should be_true
41
+ @resource.reload
42
+ end
43
+
44
+ it 'loads positions list to the state when it was dumped/persisted with keys being strings' do
45
+ @resource.positions.should == [
46
+ { 'company' => 'The Death Star, Inc', 'title' => 'Light sabre engineer' },
47
+ { 'company' => 'Sane Little Company', 'title' => 'Chief Curiosity Officer' },
48
+ ]
49
+ end
50
+ end
55
51
  end
56
52
 
57
- describe 'when dumped and loaded again' do
53
+ describe 'with positions information given as empty list' do
58
54
  before :all do
59
- @resource.save.should be_true
60
- @resource.reload
55
+ @resource.positions = []
61
56
  end
62
57
 
63
- it 'has empty positions list' do
64
- @resource.positions.should == []
58
+ describe 'when dumped and loaded again' do
59
+ before :all do
60
+ @resource.save.should be_true
61
+ @resource.reload
62
+ end
63
+
64
+ it 'has empty positions list' do
65
+ @resource.positions.should == []
66
+ end
65
67
  end
66
68
  end
67
69
  end
@@ -7,47 +7,49 @@ try_spec do
7
7
  require './spec/fixtures/article'
8
8
 
9
9
  describe DataMapper::Types::Fixtures::Article do
10
- describe "persisted with title and slug set to 'New DataMapper Type'" do
11
- before :all do
12
- @input = 'New DataMapper Type'
13
- @resource = DataMapper::Types::Fixtures::Article.create(:title => @input, :slug => @input)
14
-
15
- @resource.reload
16
- end
17
-
18
- it 'has slug equal to "new-datamapper-type"' do
19
- @resource.slug.should == 'new-datamapper-type'
20
- end
21
-
22
- it 'can be found by slug' do
23
- DataMapper::Types::Fixtures::Article.first(:slug => 'new-datamapper-type').should == @resource
24
- end
25
- end
26
-
27
- [
28
- ['Iñtërnâtiônàlizætiøn', 'internationalizaetion' ],
29
- ["This is Dan's Blog", 'this-is-dans-blog'],
30
- ['This is My Site, and Blog', 'this-is-my-site-and-blog'],
31
- ['Google searches for holy grail of Python performance', 'google-searches-for-holy-grail-of-python-performance'],
32
- ['iPhone dev: Creating length-controlled data sources', 'iphone-dev-creating-length-controlled-data-sources'],
33
- ["Review: Nintendo's New DSi -- A Quantum Leap Forward", 'review-nintendos-new-dsi-a-quantum-leap-forward'],
34
- ["Arriva BraiVe, è l'auto-robot che si 'guida' da sola'", 'arriva-braive-e-lauto-robot-che-si-guida-da-sola'],
35
- ["La ley antipiratería reduce un 33% el tráfico online en Suecia", 'la-ley-antipirateria-reduce-un-33-percent-el-trafico-online-en-suecia'],
36
- ["L'Etat américain du Texas s'apprête à interdire Windows Vista", 'letat-americain-du-texas-sapprete-a-interdire-windows-vista']
37
- ].each do |title, slug|
38
- describe "persisted with title '#{title}'" do
10
+ supported_by :all do
11
+ describe "persisted with title and slug set to 'New DataMapper Type'" do
39
12
  before :all do
40
- @resource = DataMapper::Types::Fixtures::Article.new(:title => title)
41
- @resource.save.should be_true
13
+ @input = 'New DataMapper Type'
14
+ @resource = DataMapper::Types::Fixtures::Article.create(:title => @input, :slug => @input)
15
+
42
16
  @resource.reload
43
17
  end
44
18
 
45
- it "has slug equal to '#{slug}'" do
46
- @resource.slug.should == slug
19
+ it 'has slug equal to "new-datamapper-type"' do
20
+ @resource.slug.should == 'new-datamapper-type'
47
21
  end
48
22
 
49
23
  it 'can be found by slug' do
50
- DataMapper::Types::Fixtures::Article.first(:slug => slug).should == @resource
24
+ DataMapper::Types::Fixtures::Article.first(:slug => 'new-datamapper-type').should == @resource
25
+ end
26
+ end
27
+
28
+ [
29
+ ['Iñtërnâtiônàlizætiøn', 'internationalizaetion' ],
30
+ ["This is Dan's Blog", 'this-is-dans-blog'],
31
+ ['This is My Site, and Blog', 'this-is-my-site-and-blog'],
32
+ ['Google searches for holy grail of Python performance', 'google-searches-for-holy-grail-of-python-performance'],
33
+ ['iPhone dev: Creating length-controlled data sources', 'iphone-dev-creating-length-controlled-data-sources'],
34
+ ["Review: Nintendo's New DSi -- A Quantum Leap Forward", 'review-nintendos-new-dsi-a-quantum-leap-forward'],
35
+ ["Arriva BraiVe, è l'auto-robot che si 'guida' da sola'", 'arriva-braive-e-lauto-robot-che-si-guida-da-sola'],
36
+ ["La ley antipiratería reduce un 33% el tráfico online en Suecia", 'la-ley-antipirateria-reduce-un-33-percent-el-trafico-online-en-suecia'],
37
+ ["L'Etat américain du Texas s'apprête à interdire Windows Vista", 'letat-americain-du-texas-sapprete-a-interdire-windows-vista']
38
+ ].each do |title, slug|
39
+ describe "persisted with title '#{title}'" do
40
+ before :all do
41
+ @resource = DataMapper::Types::Fixtures::Article.new(:title => title)
42
+ @resource.save.should be_true
43
+ @resource.reload
44
+ end
45
+
46
+ it "has slug equal to '#{slug}'" do
47
+ @resource.slug.should == slug
48
+ end
49
+
50
+ it 'can be found by slug' do
51
+ DataMapper::Types::Fixtures::Article.first(:slug => slug).should == @resource
52
+ end
51
53
  end
52
54
  end
53
55
  end
@@ -5,83 +5,85 @@ try_spec do
5
5
  require './spec/fixtures/bookmark'
6
6
 
7
7
  describe DataMapper::Types::Fixtures::Bookmark do
8
- describe 'without URI' do
9
- before :all do
10
- @uri = nil
11
- @resource = DataMapper::Types::Fixtures::Bookmark.new(
12
- :title => 'Check this out',
13
- :uri => @uri,
14
- :shared => false,
15
- :tags => %w[ misc ]
16
- )
17
-
18
- @resource.save.should be_true
19
- end
20
-
21
- it 'can be found by uri' do
22
- DataMapper::Types::Fixtures::Bookmark.first(:uri => @uri).should == @resource
23
- end
24
-
25
- describe 'when reloaded' do
8
+ supported_by :all do
9
+ describe 'without URI' do
26
10
  before :all do
27
- @resource.reload
11
+ @uri = nil
12
+ @resource = DataMapper::Types::Fixtures::Bookmark.new(
13
+ :title => 'Check this out',
14
+ :uri => @uri,
15
+ :shared => false,
16
+ :tags => %w[ misc ]
17
+ )
18
+
19
+ @resource.save.should be_true
28
20
  end
29
21
 
30
- it 'has no uri' do
31
- @resource.uri.should be_nil
22
+ it 'can be found by uri' do
23
+ DataMapper::Types::Fixtures::Bookmark.first(:uri => @uri).should == @resource
32
24
  end
33
- end
34
- end
35
25
 
36
- describe 'with a blank URI' do
37
- before :all do
38
- @uri = ''
39
- @resource = DataMapper::Types::Fixtures::Bookmark.new(
40
- :title => 'Check this out',
41
- :uri => @uri,
42
- :shared => false,
43
- :tags => %w[ misc ]
44
- )
45
-
46
- @resource.save.should be_true
47
- end
26
+ describe 'when reloaded' do
27
+ before :all do
28
+ @resource.reload
29
+ end
48
30
 
49
- it 'can be found by uri' do
50
- DataMapper::Types::Fixtures::Bookmark.first(:uri => @uri).should == @resource
31
+ it 'has no uri' do
32
+ @resource.uri.should be_nil
33
+ end
34
+ end
51
35
  end
52
36
 
53
- describe 'when reloaded' do
37
+ describe 'with a blank URI' do
54
38
  before :all do
55
- @resource.reload
39
+ @uri = ''
40
+ DataMapper::Types::Fixtures::Bookmark.auto_migrate!
41
+ @resource = DataMapper::Types::Fixtures::Bookmark.new(
42
+ :title => 'Check this out',
43
+ :uri => @uri,
44
+ :shared => false,
45
+ :tags => %w[ misc ]
46
+ )
47
+
48
+ @resource.save.should be_true
56
49
  end
57
50
 
58
- it 'is loaded as URI object' do
59
- @resource.uri.should be_an_instance_of(Addressable::URI)
51
+ it 'can be found by uri' do
52
+ DataMapper::Types::Fixtures::Bookmark.first(:uri => @uri).should == @resource
60
53
  end
61
54
 
62
- it 'has the same original URI' do
63
- @resource.uri.to_s.should == @uri
55
+ describe 'when reloaded' do
56
+ before :all do
57
+ @resource.reload
58
+ end
59
+
60
+ it 'is loaded as URI object' do
61
+ @resource.uri.should be_an_instance_of(Addressable::URI)
62
+ end
63
+
64
+ it 'has the same original URI' do
65
+ @resource.uri.to_s.should == @uri
66
+ end
64
67
  end
65
68
  end
66
- end
67
69
 
68
- describe 'with invalid URI' do
69
- before :all do
70
- @uri = 'this is def. not URI'
71
- @resource = DataMapper::Types::Fixtures::Bookmark.new(
72
- :title => 'Check this out',
73
- :uri => @uri,
74
- :shared => false,
75
- :tags => %w[ misc ]
76
- )
77
- end
70
+ describe 'with invalid URI' do
71
+ before :all do
72
+ @uri = 'this is def. not URI'
73
+ @resource = DataMapper::Types::Fixtures::Bookmark.new(
74
+ :title => 'Check this out',
75
+ :uri => @uri,
76
+ :shared => false,
77
+ :tags => %w[ misc ]
78
+ )
79
+ end
78
80
 
79
- it 'is perfectly valid (URI type does not provide auto validations)' do
80
- @resource.save.should be_true
81
+ it 'is perfectly valid (URI type does not provide auto validations)' do
82
+ @resource.save.should be_true
83
+ end
81
84
  end
82
- end
83
85
 
84
- %w[
86
+ %w[
85
87
  http://apple.com
86
88
  http://www.apple.com
87
89
  http://apple.com/
@@ -104,30 +106,31 @@ try_spec do
104
106
  http://www.hulu.com/watch/64923/terminator-the-sarah-connor-chronicles-to-the-lighthouse
105
107
  http://hulu.com:80/browse/popular/tv
106
108
  http://www.hulu.com/watch/62475/the-simpsons-gone-maggie-gone#s-p1-so-i0
107
- ].each do |uri|
108
- describe "with URI set to '#{uri}'" do
109
- before :all do
110
- @resource = DataMapper::Types::Fixtures::Bookmark.new(
111
- :title => 'Check this out',
112
- :uri => uri,
113
- :shared => false,
114
- :tags => %w[ misc ]
115
- )
116
-
117
- @resource.save.should be_true
118
- end
119
-
120
- it 'can be found by uri' do
121
- DataMapper::Types::Fixtures::Bookmark.first(:uri => uri).should_not be_blank
122
- end
123
-
124
- describe 'when reloaded' do
109
+ ].each do |uri|
110
+ describe "with URI set to '#{uri}'" do
125
111
  before :all do
126
- @resource.reload
112
+ @resource = DataMapper::Types::Fixtures::Bookmark.new(
113
+ :title => 'Check this out',
114
+ :uri => uri,
115
+ :shared => false,
116
+ :tags => %w[ misc ]
117
+ )
118
+
119
+ @resource.save.should be_true
127
120
  end
128
121
 
129
- it 'has the same original URI' do
130
- @resource.uri.to_s.should eql(uri)
122
+ it 'can be found by uri' do
123
+ DataMapper::Types::Fixtures::Bookmark.first(:uri => uri).should_not be_blank
124
+ end
125
+
126
+ describe 'when reloaded' do
127
+ before :all do
128
+ @resource.reload
129
+ end
130
+
131
+ it 'has the same original URI' do
132
+ @resource.uri.to_s.should eql(uri)
133
+ end
131
134
  end
132
135
  end
133
136
  end