gom 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/README.rdoc +15 -0
  2. data/Rakefile +1 -1
  3. data/lib/gom.rb +1 -0
  4. data/lib/gom/object.rb +15 -19
  5. data/lib/gom/object/builder.rb +35 -33
  6. data/lib/gom/object/cached_builder.rb +23 -31
  7. data/lib/gom/object/collection.rb +49 -57
  8. data/lib/gom/object/draft.rb +17 -25
  9. data/lib/gom/object/id.rb +14 -22
  10. data/lib/gom/object/inspector.rb +46 -54
  11. data/lib/gom/object/mapping.rb +31 -47
  12. data/lib/gom/object/proxy.rb +25 -33
  13. data/lib/gom/spec.rb +11 -0
  14. data/lib/gom/spec/acceptance/adapter_that_needs_setup.rb +58 -0
  15. data/lib/gom/spec/acceptance/adapter_with_stateful_storage.rb +19 -21
  16. data/lib/gom/spec/acceptance/read_only_adapter_with_stateless_storage.rb +9 -8
  17. data/lib/gom/spec/object.rb +8 -0
  18. data/lib/gom/storage.rb +30 -26
  19. data/lib/gom/storage/adapter.rb +26 -43
  20. data/lib/gom/storage/configuration.rb +75 -68
  21. data/lib/gom/storage/configuration/view.rb +3 -16
  22. data/lib/gom/storage/configuration/view/class.rb +5 -22
  23. data/lib/gom/storage/configuration/view/map_reduce.rb +7 -24
  24. data/lib/gom/storage/fetcher.rb +24 -32
  25. data/lib/gom/storage/remover.rb +27 -35
  26. data/lib/gom/storage/saver.rb +35 -43
  27. data/spec/acceptance/adapter_spec.rb +16 -4
  28. data/spec/acceptance/fake_adapter_spec.rb +11 -0
  29. data/spec/acceptance/object_spec.rb +4 -1
  30. data/spec/fake_adapter.rb +12 -3
  31. data/spec/lib/gom/object/builder_spec.rb +5 -5
  32. data/spec/lib/gom/object/inspector_spec.rb +5 -9
  33. data/spec/lib/gom/object/mapping_spec.rb +27 -57
  34. data/spec/lib/gom/storage/adapter_spec.rb +1 -1
  35. data/spec/lib/gom/storage/configuration_spec.rb +33 -3
  36. data/spec/lib/gom/storage_spec.rb +19 -0
  37. metadata +50 -46
@@ -30,7 +30,7 @@ describe GOM::Storage::Adapter do
30
30
 
31
31
  end
32
32
 
33
- [ :setup, :fetch, :store, :remove, :collection ].each do |method_name|
33
+ [ :setup, :teardown, :fetch, :store, :remove, :collection ].each do |method_name|
34
34
 
35
35
  describe "#{method_name}" do
36
36
 
@@ -20,10 +20,27 @@ describe GOM::Storage::Configuration do
20
20
 
21
21
  end
22
22
 
23
- describe "name" do
23
+ describe "teardown" do
24
24
 
25
- it "should return the configuration's name" do
26
- @configuration.name.should == "test_storage"
25
+ it "should call teardown on the adapter instance" do
26
+ @adapter.should_receive(:teardown)
27
+ @configuration.teardown
28
+ end
29
+
30
+ end
31
+
32
+ describe "adapter_class" do
33
+
34
+ it "should return the adapter class" do
35
+ adapter_class = @configuration.adapter_class
36
+ adapter_class.should == @adapter_class
37
+ end
38
+
39
+ it "should raise a #{GOM::Storage::AdapterNotFoundError} if adapter name is invalid" do
40
+ GOM::Storage::Adapter.stub(:[]).and_return(nil)
41
+ lambda do
42
+ @configuration.adapter_class
43
+ end.should raise_error(GOM::Storage::AdapterNotFoundError)
27
44
  end
28
45
 
29
46
  end
@@ -103,6 +120,19 @@ describe GOM::Storage::Configuration do
103
120
 
104
121
  end
105
122
 
123
+ describe "teardown_all" do
124
+
125
+ before :each do
126
+ @configuration.stub(:teardown)
127
+ end
128
+
129
+ it "should call teardown on each configuration" do
130
+ @configuration.should_receive(:teardown)
131
+ described_class.teardown_all
132
+ end
133
+
134
+ end
135
+
106
136
  describe "default" do
107
137
 
108
138
  it "should select the first configuration" do
@@ -10,9 +10,15 @@ describe GOM::Storage do
10
10
  describe "setup" do
11
11
 
12
12
  before :each do
13
+ GOM::Object::Mapping.stub(:clear!)
13
14
  described_class::Configuration.stub(:setup_all)
14
15
  end
15
16
 
17
+ it "should clear the mapping" do
18
+ GOM::Object::Mapping.should_receive(:clear!)
19
+ described_class.setup
20
+ end
21
+
16
22
  it "should setup all storage configurations" do
17
23
  described_class::Configuration.should_receive(:setup_all)
18
24
  described_class.setup
@@ -20,6 +26,19 @@ describe GOM::Storage do
20
26
 
21
27
  end
22
28
 
29
+ describe "teardown" do
30
+
31
+ before :each do
32
+ described_class::Configuration.stub(:teardown_all)
33
+ end
34
+
35
+ it "should teardown all storage configurations" do
36
+ described_class::Configuration.should_receive(:teardown_all)
37
+ described_class.teardown
38
+ end
39
+
40
+ end
41
+
23
42
  describe "fetch" do
24
43
 
25
44
  before :each do
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 0.2.0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Philipp Br\xC3\xBCll"
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-20 00:00:00 +01:00
17
+ date: 2011-02-17 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -56,49 +56,52 @@ files:
56
56
  - README.rdoc
57
57
  - LICENSE
58
58
  - Rakefile
59
- - lib/gom.rb
60
- - lib/gom/storage/adapter.rb
61
- - lib/gom/storage/saver.rb
62
- - lib/gom/storage/fetcher.rb
63
- - lib/gom/storage/remover.rb
64
- - lib/gom/storage/configuration/view/class.rb
65
- - lib/gom/storage/configuration/view/map_reduce.rb
66
- - lib/gom/storage/configuration/view.rb
67
- - lib/gom/storage/configuration.rb
68
- - lib/gom/object.rb
69
59
  - lib/gom/storage.rb
70
- - lib/gom/spec/acceptance/adapter_with_stateful_storage.rb
71
- - lib/gom/spec/acceptance/read_only_adapter_with_stateless_storage.rb
72
- - lib/gom/spec.rb
73
- - lib/gom/object/mapping.rb
74
- - lib/gom/object/builder.rb
75
- - lib/gom/object/inspector.rb
76
60
  - lib/gom/object/id.rb
61
+ - lib/gom/object/inspector.rb
62
+ - lib/gom/object/collection.rb
77
63
  - lib/gom/object/cached_builder.rb
78
64
  - lib/gom/object/draft.rb
65
+ - lib/gom/object/builder.rb
79
66
  - lib/gom/object/proxy.rb
80
- - lib/gom/object/collection.rb
67
+ - lib/gom/object/mapping.rb
68
+ - lib/gom/object.rb
69
+ - lib/gom/spec/acceptance/adapter_with_stateful_storage.rb
70
+ - lib/gom/spec/acceptance/read_only_adapter_with_stateless_storage.rb
71
+ - lib/gom/spec/acceptance/adapter_that_needs_setup.rb
72
+ - lib/gom/spec/object.rb
73
+ - lib/gom/storage/fetcher.rb
74
+ - lib/gom/storage/saver.rb
75
+ - lib/gom/storage/remover.rb
76
+ - lib/gom/storage/configuration.rb
77
+ - lib/gom/storage/configuration/view.rb
78
+ - lib/gom/storage/configuration/view/map_reduce.rb
79
+ - lib/gom/storage/configuration/view/class.rb
80
+ - lib/gom/storage/adapter.rb
81
+ - lib/gom/spec.rb
82
+ - lib/gom.rb
83
+ - spec/storage.configuration
84
+ - spec/lib/gom/storage_spec.rb
81
85
  - spec/lib/gom/object_spec.rb
82
- - spec/lib/gom/storage/fetcher_spec.rb
86
+ - spec/lib/gom/object/builder_spec.rb
87
+ - spec/lib/gom/object/proxy_spec.rb
88
+ - spec/lib/gom/object/cached_builder_spec.rb
89
+ - spec/lib/gom/object/collection_spec.rb
90
+ - spec/lib/gom/object/mapping_spec.rb
91
+ - spec/lib/gom/object/id_spec.rb
92
+ - spec/lib/gom/object/draft_spec.rb
93
+ - spec/lib/gom/object/inspector_spec.rb
83
94
  - spec/lib/gom/storage/configuration_spec.rb
84
- - spec/lib/gom/storage/remover_spec.rb
85
- - spec/lib/gom/storage/saver_spec.rb
86
95
  - spec/lib/gom/storage/configuration/view/class_spec.rb
87
96
  - spec/lib/gom/storage/configuration/view/map_reduce_spec.rb
88
97
  - spec/lib/gom/storage/adapter_spec.rb
89
- - spec/lib/gom/object/mapping_spec.rb
90
- - spec/lib/gom/object/draft_spec.rb
91
- - spec/lib/gom/object/proxy_spec.rb
92
- - spec/lib/gom/object/inspector_spec.rb
93
- - spec/lib/gom/object/builder_spec.rb
94
- - spec/lib/gom/object/collection_spec.rb
95
- - spec/lib/gom/object/cached_builder_spec.rb
96
- - spec/lib/gom/object/id_spec.rb
97
- - spec/lib/gom/storage_spec.rb
98
- - spec/storage.configuration
99
- - spec/spec_helper.rb
98
+ - spec/lib/gom/storage/fetcher_spec.rb
99
+ - spec/lib/gom/storage/saver_spec.rb
100
+ - spec/lib/gom/storage/remover_spec.rb
101
+ - spec/acceptance/fake_adapter_spec.rb
100
102
  - spec/acceptance/object_spec.rb
101
103
  - spec/acceptance/adapter_spec.rb
104
+ - spec/spec_helper.rb
102
105
  - spec/fake_adapter.rb
103
106
  has_rdoc: true
104
107
  homepage: http://github.com/phifty/gom
@@ -133,22 +136,23 @@ signing_key:
133
136
  specification_version: 3
134
137
  summary: General Object Mapper - maps any ruby object to different kinds of storage engines and vice versa.
135
138
  test_files:
139
+ - spec/lib/gom/storage_spec.rb
136
140
  - spec/lib/gom/object_spec.rb
137
- - spec/lib/gom/storage/fetcher_spec.rb
141
+ - spec/lib/gom/object/builder_spec.rb
142
+ - spec/lib/gom/object/proxy_spec.rb
143
+ - spec/lib/gom/object/cached_builder_spec.rb
144
+ - spec/lib/gom/object/collection_spec.rb
145
+ - spec/lib/gom/object/mapping_spec.rb
146
+ - spec/lib/gom/object/id_spec.rb
147
+ - spec/lib/gom/object/draft_spec.rb
148
+ - spec/lib/gom/object/inspector_spec.rb
138
149
  - spec/lib/gom/storage/configuration_spec.rb
139
- - spec/lib/gom/storage/remover_spec.rb
140
- - spec/lib/gom/storage/saver_spec.rb
141
150
  - spec/lib/gom/storage/configuration/view/class_spec.rb
142
151
  - spec/lib/gom/storage/configuration/view/map_reduce_spec.rb
143
152
  - spec/lib/gom/storage/adapter_spec.rb
144
- - spec/lib/gom/object/mapping_spec.rb
145
- - spec/lib/gom/object/draft_spec.rb
146
- - spec/lib/gom/object/proxy_spec.rb
147
- - spec/lib/gom/object/inspector_spec.rb
148
- - spec/lib/gom/object/builder_spec.rb
149
- - spec/lib/gom/object/collection_spec.rb
150
- - spec/lib/gom/object/cached_builder_spec.rb
151
- - spec/lib/gom/object/id_spec.rb
152
- - spec/lib/gom/storage_spec.rb
153
+ - spec/lib/gom/storage/fetcher_spec.rb
154
+ - spec/lib/gom/storage/saver_spec.rb
155
+ - spec/lib/gom/storage/remover_spec.rb
156
+ - spec/acceptance/fake_adapter_spec.rb
153
157
  - spec/acceptance/object_spec.rb
154
158
  - spec/acceptance/adapter_spec.rb