gom 0.1.0
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.
- data/LICENSE +20 -0
- data/README.rdoc +111 -0
- data/Rakefile +48 -0
- data/lib/gom.rb +7 -0
- data/lib/gom/object.rb +23 -0
- data/lib/gom/object/id.rb +30 -0
- data/lib/gom/object/injector.rb +45 -0
- data/lib/gom/object/inspector.rb +55 -0
- data/lib/gom/object/mapping.rb +61 -0
- data/lib/gom/object/proxy.rb +44 -0
- data/lib/gom/spec.rb +4 -0
- data/lib/gom/spec/acceptance/adapter_with_stateful_storage.rb +111 -0
- data/lib/gom/spec/acceptance/read_only_adapter_with_stateless_storage.rb +50 -0
- data/lib/gom/storage.rb +35 -0
- data/lib/gom/storage/adapter.rb +51 -0
- data/lib/gom/storage/configuration.rb +65 -0
- data/lib/gom/storage/fetcher.rb +69 -0
- data/lib/gom/storage/remover.rb +47 -0
- data/lib/gom/storage/saver.rb +59 -0
- data/spec/acceptance/adapter_spec.rb +10 -0
- data/spec/acceptance/object_spec.rb +33 -0
- data/spec/fake_adapter.rb +37 -0
- data/spec/lib/gom/object/id_spec.rb +56 -0
- data/spec/lib/gom/object/injector_spec.rb +51 -0
- data/spec/lib/gom/object/inspector_spec.rb +30 -0
- data/spec/lib/gom/object/mapping_spec.rb +158 -0
- data/spec/lib/gom/object/proxy_spec.rb +91 -0
- data/spec/lib/gom/object_spec.rb +40 -0
- data/spec/lib/gom/storage/adapter_spec.rb +73 -0
- data/spec/lib/gom/storage/configuration_spec.rb +92 -0
- data/spec/lib/gom/storage/fetcher_spec.rb +89 -0
- data/spec/lib/gom/storage/remover_spec.rb +47 -0
- data/spec/lib/gom/storage/saver_spec.rb +86 -0
- data/spec/lib/gom/storage_spec.rb +106 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/storage.configuration +4 -0
- metadata +138 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))
|
2
|
+
|
3
|
+
describe GOM::Object do
|
4
|
+
|
5
|
+
describe "id" do
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
@id_string = "test_storage:object_1"
|
9
|
+
@id = GOM::Object::Id.new @id_string
|
10
|
+
@object = Object.new
|
11
|
+
GOM::Object::Mapping.stub!(:id_by_object).and_return(@id)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should call id_by_object of object mapping" do
|
15
|
+
GOM::Object::Mapping.should_receive(:id_by_object).with(@object).and_return(@id)
|
16
|
+
GOM::Object.id(@object).should == @id_string
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should return nil if the call of id_by_object returned nil" do
|
20
|
+
GOM::Object::Mapping.stub!(:id_by_object).and_return(nil)
|
21
|
+
GOM::Object.id(@object).should be_nil
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "reference" do
|
27
|
+
|
28
|
+
before :each do
|
29
|
+
@object = Object.new
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return a proxy for the given object" do
|
33
|
+
proxy = GOM::Object.reference @object
|
34
|
+
proxy.should be_instance_of(GOM::Object::Proxy)
|
35
|
+
proxy.object.should == @object
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "spec_helper"))
|
2
|
+
|
3
|
+
describe GOM::Storage::Adapter do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@configuration = Object.new
|
7
|
+
@adapter = GOM::Storage::Adapter.new @configuration
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "register" do
|
11
|
+
|
12
|
+
it "should register a given adapter with a given id" do
|
13
|
+
GOM::Storage::Adapter.register :test_adapter, @adapter.class
|
14
|
+
GOM::Storage::Adapter[:test_adapter].should == @adapter.class
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "[]" do
|
20
|
+
|
21
|
+
it "should return the adapter class" do
|
22
|
+
GOM::Storage::Adapter.register :test_adapter, @adapter.class
|
23
|
+
GOM::Storage::Adapter[:test_adapter].should == @adapter.class
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should return nil if no adapter is registered" do
|
27
|
+
GOM::Storage::Adapter.instance_variable_set :@adapter_classes, nil
|
28
|
+
GOM::Storage::Adapter[:test_adapter].should be_nil
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "setup" do
|
34
|
+
|
35
|
+
it "should raise a NotImplementedError" do
|
36
|
+
lambda do
|
37
|
+
@adapter.setup
|
38
|
+
end.should raise_error(NotImplementedError)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "fetch" do
|
44
|
+
|
45
|
+
it "should raise a NotImplementedError" do
|
46
|
+
lambda do
|
47
|
+
@adapter.fetch
|
48
|
+
end.should raise_error(NotImplementedError)
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "store" do
|
54
|
+
|
55
|
+
it "should raise a NotImplementedError" do
|
56
|
+
lambda do
|
57
|
+
@adapter.store
|
58
|
+
end.should raise_error(NotImplementedError)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "remove" do
|
64
|
+
|
65
|
+
it "should raise a NotImplementedError" do
|
66
|
+
lambda do
|
67
|
+
@adapter.remove
|
68
|
+
end.should raise_error(NotImplementedError)
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "spec_helper"))
|
2
|
+
|
3
|
+
describe GOM::Storage::Configuration do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@adapter = mock GOM::Storage::Adapter, :setup => nil
|
7
|
+
@adapter_class = mock Class, :new => @adapter
|
8
|
+
GOM::Storage::Adapter.stub(:[]).and_return(@adapter_class)
|
9
|
+
|
10
|
+
described_class.read File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "storage.configuration"))
|
11
|
+
@configuration = described_class[:test_storage]
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "setup" do
|
15
|
+
|
16
|
+
it "should call setup on the adapter instance" do
|
17
|
+
@adapter.should_receive(:setup)
|
18
|
+
@configuration.setup
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "name" do
|
24
|
+
|
25
|
+
it "should return the configuration's name" do
|
26
|
+
@configuration.name.should == "test_storage"
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "[]" do
|
32
|
+
|
33
|
+
it "should return the configuration value" do
|
34
|
+
@configuration[:test].should == "test value"
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "values_at" do
|
40
|
+
|
41
|
+
it "should return multiple configuration values" do
|
42
|
+
@configuration.values_at(:adapter, :test).should == [ "fake_adapter", "test value" ]
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "read" do
|
48
|
+
|
49
|
+
it "should read the configuration file" do
|
50
|
+
@configuration.should be_instance_of(described_class)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should initialize the right adapter class" do
|
54
|
+
@configuration.adapter_class.should == @adapter_class
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should create an adapter instance if requested" do
|
58
|
+
@adapter_class.should_receive(:new).with(@configuration).and_return(@adapter)
|
59
|
+
@configuration.adapter.should == @adapter
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "setup_all" do
|
65
|
+
|
66
|
+
before :each do
|
67
|
+
@configuration.stub(:setup)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should call setup on each configuration" do
|
71
|
+
@configuration.should_receive(:setup)
|
72
|
+
described_class.setup_all
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "default" do
|
78
|
+
|
79
|
+
it "should select the first configuration" do
|
80
|
+
described_class.default.should == GOM::Storage::Configuration[:test_storage]
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should raise StandardError if no configuration loaded" do
|
84
|
+
described_class.instance_variable_set :@configurations, { }
|
85
|
+
lambda do
|
86
|
+
described_class.default
|
87
|
+
end.should raise_error(StandardError)
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "spec_helper"))
|
2
|
+
|
3
|
+
describe GOM::Storage::Fetcher do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@id = GOM::Object::Id.new "test_storage", "object_1"
|
7
|
+
@object = Object.new
|
8
|
+
@object.instance_variable_set :@test, "test value"
|
9
|
+
@object_hash = {
|
10
|
+
:class => "Object",
|
11
|
+
:properties => { :test => "test value" }
|
12
|
+
}
|
13
|
+
|
14
|
+
@new_method = mock Method, :arity => 3
|
15
|
+
@klass = mock Class, :new => @object, :method => @new_method
|
16
|
+
Object.stub(:const_get).and_return(@klass)
|
17
|
+
|
18
|
+
@adapter = mock GOM::Storage::Adapter, :fetch => @object_hash
|
19
|
+
@configuration = mock GOM::Storage::Configuration, :adapter => @adapter
|
20
|
+
GOM::Storage::Configuration.stub(:[]).and_return(@configuration)
|
21
|
+
|
22
|
+
GOM::Object::Mapping.stub(:object_by_id)
|
23
|
+
GOM::Object::Mapping.stub(:put)
|
24
|
+
|
25
|
+
@injector = mock GOM::Object::Injector, :perform => nil, :object => @object
|
26
|
+
GOM::Object::Injector.stub(:new).and_return(@injector)
|
27
|
+
|
28
|
+
@fetcher = described_class.new @id
|
29
|
+
@fetcher.stub(:object_class).and_return(@klass)
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "object" do
|
33
|
+
|
34
|
+
it "should do no fetch if no id is given" do
|
35
|
+
@fetcher.id = nil
|
36
|
+
@adapter.should_not_receive(:fetch)
|
37
|
+
@fetcher.object
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should route the call to the correct storage" do
|
41
|
+
GOM::Storage::Configuration.should_receive(:[]).with("test_storage")
|
42
|
+
@fetcher.object
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should fetch the id from the adapter instance" do
|
46
|
+
@adapter.should_receive(:fetch).with("object_1").and_return(@object_hash)
|
47
|
+
@fetcher.object
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should initialize the object with nil-arguments to the constructor" do
|
51
|
+
@klass.should_receive(:new).with(nil, nil, nil).and_return(@object)
|
52
|
+
@fetcher.object
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should initialize the object with no arguments to the constructor if a variable argument count is needed" do
|
56
|
+
@new_method.stub(:arity).and_return(-1)
|
57
|
+
@klass.should_receive(:new).with(no_args).and_return(@object)
|
58
|
+
@fetcher.object
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should check if a mapping exists for the object" do
|
62
|
+
GOM::Object::Mapping.should_receive(:object_by_id).with(@id).and_return(Object.new)
|
63
|
+
@fetcher.object
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should initialize the object if not given" do
|
67
|
+
GOM::Object::Injector.should_receive(:new).with(anything, @object_hash).and_return(@injector)
|
68
|
+
@fetcher.object
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should create mapping between object and id" do
|
72
|
+
GOM::Object::Mapping.should_receive(:put).with(@object, @id)
|
73
|
+
@fetcher.object
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should set the object's instance variables" do
|
77
|
+
object = @fetcher.object
|
78
|
+
object.instance_variable_get(:@test).should == "test value"
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should return nil if storage adapter returned nil" do
|
82
|
+
@adapter.stub(:fetch).and_return(nil)
|
83
|
+
object = @fetcher.object
|
84
|
+
object.should be_nil
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "spec_helper"))
|
2
|
+
|
3
|
+
describe GOM::Storage::Remover do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@id = GOM::Object::Id.new "test_storage", "object_1"
|
7
|
+
@object = Object.new
|
8
|
+
|
9
|
+
@adapter = Object.new
|
10
|
+
@adapter.stub!(:remove)
|
11
|
+
@configuration = Object.new
|
12
|
+
@configuration.stub!(:adapter).and_return(@adapter)
|
13
|
+
GOM::Storage::Configuration.stub!(:[]).and_return(@configuration)
|
14
|
+
|
15
|
+
GOM::Object::Mapping.stub!(:id_by_object).with(@object).and_return(@id)
|
16
|
+
GOM::Object::Mapping.stub!(:remove_by_object)
|
17
|
+
|
18
|
+
@remover = GOM::Storage::Remover.new @object
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "perform" do
|
22
|
+
|
23
|
+
it "should route the call to the correct storage" do
|
24
|
+
GOM::Storage::Configuration.should_receive(:[]).with("test_storage")
|
25
|
+
@remover.perform
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should remove the object with the adapter instance" do
|
29
|
+
@adapter.should_receive(:remove).with("object_1")
|
30
|
+
@remover.perform
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should raise an ArugmentError if no mapping for the given object exists" do
|
34
|
+
GOM::Object::Mapping.stub!(:id_by_object).with(@object).and_return(nil)
|
35
|
+
lambda do
|
36
|
+
@remover.perform
|
37
|
+
end.should raise_error(ArgumentError)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should remove the mapping" do
|
41
|
+
GOM::Object::Mapping.should_receive(:remove_by_object).with(@object)
|
42
|
+
@remover.perform
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "spec_helper"))
|
2
|
+
|
3
|
+
describe GOM::Storage::Saver do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@id = GOM::Object::Id.new "test_storage", "object_1"
|
7
|
+
@object = Object.new
|
8
|
+
@object.instance_variable_set :@test, "test value"
|
9
|
+
@object.freeze
|
10
|
+
@object_hash = {
|
11
|
+
:class => "Object",
|
12
|
+
:id => "object_1",
|
13
|
+
:properties => {
|
14
|
+
:test => "test value"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
GOM::Object::Mapping.stub!(:id_by_object).with(@object).and_return(@id)
|
19
|
+
GOM::Object::Mapping.stub!(:put)
|
20
|
+
|
21
|
+
@adapter = Object.new
|
22
|
+
@adapter.stub!(:store).and_return("object_1")
|
23
|
+
@configuration = Object.new
|
24
|
+
@configuration.stub!(:name).and_return("default_test_storage")
|
25
|
+
@configuration.stub!(:adapter).and_return(@adapter)
|
26
|
+
GOM::Storage::Configuration.stub!(:[]).and_return(@configuration)
|
27
|
+
GOM::Storage::Configuration.stub!(:default).and_return(@configuration)
|
28
|
+
|
29
|
+
@inspector = Object.new
|
30
|
+
@inspector.stub!(:perform)
|
31
|
+
@inspector.stub!(:object_hash).and_return(@object_hash)
|
32
|
+
GOM::Object::Inspector.stub!(:new).and_return(@inspector)
|
33
|
+
|
34
|
+
@saver = GOM::Storage::Saver.new @object
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "perform" do
|
38
|
+
|
39
|
+
it "should check the mapping if an id is existing" do
|
40
|
+
GOM::Object::Mapping.should_receive(:id_by_object).with(@object).and_return(@id)
|
41
|
+
@saver.perform
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should override the storage name if given" do
|
45
|
+
@saver.instance_variable_set :@storage_name, "another_test_storage"
|
46
|
+
@saver.perform
|
47
|
+
@saver.storage_name.should == "another_test_storage"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should select the default storage if no storage name can be detected" do
|
51
|
+
GOM::Object::Mapping.stub!(:id_by_object).with(@object).and_return(nil)
|
52
|
+
@saver.perform
|
53
|
+
@saver.storage_name.should == "default_test_storage"
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should select the correct storage" do
|
57
|
+
GOM::Storage::Configuration.should_receive(:[]).with("test_storage").and_return(@configuration)
|
58
|
+
@saver.perform
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should store the object with the adapter instance" do
|
62
|
+
@adapter.should_receive(:store).with(@object_hash).and_return("object_1")
|
63
|
+
@saver.perform
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should store the object without an id if no mapping exists" do
|
67
|
+
GOM::Object::Mapping.stub!(:id_by_object).with(@object).and_return(nil)
|
68
|
+
@object_hash.delete :id
|
69
|
+
|
70
|
+
@adapter.should_receive(:store).with(@object_hash).and_return("object_1")
|
71
|
+
@saver.perform
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should inspect the object" do
|
75
|
+
@inspector.should_receive(:perform)
|
76
|
+
@saver.perform
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should create a mapping between object and id" do
|
80
|
+
GOM::Object::Mapping.should_receive(:put).with(@object, @id)
|
81
|
+
@saver.perform
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))
|
2
|
+
|
3
|
+
describe GOM::Storage do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@id_string = "test_storage:object_1"
|
7
|
+
@object = Object.new
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "setup" do
|
11
|
+
|
12
|
+
before :each do
|
13
|
+
described_class::Configuration.stub(:setup_all)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should setup all storage configurations" do
|
17
|
+
described_class::Configuration.should_receive(:setup_all)
|
18
|
+
described_class.setup
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "fetch" do
|
24
|
+
|
25
|
+
before :each do
|
26
|
+
@id = mock GOM::Object::Id
|
27
|
+
GOM::Object::Id.stub(:new).and_return(@id)
|
28
|
+
|
29
|
+
@fetcher = mock GOM::Storage::Fetcher, :object => @object
|
30
|
+
described_class::Fetcher.stub(:new).and_return(@fetcher)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should initialize the id correctly" do
|
34
|
+
GOM::Object::Id.should_receive(:new).with(@id_string).and_return(@id)
|
35
|
+
described_class.fetch @id_string
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should initialize the fetcher correctly" do
|
39
|
+
GOM::Storage::Fetcher.should_receive(:new).with(@id).and_return(@fetcher)
|
40
|
+
described_class.fetch @id_string
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should return the object" do
|
44
|
+
described_class.fetch(@id_string).should == @object
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should return nil if nil is given" do
|
48
|
+
described_class::Fetcher.should_receive(:new).with(nil).and_return(@fetcher)
|
49
|
+
@fetcher.stub(:object).and_return(nil)
|
50
|
+
|
51
|
+
described_class.fetch(nil).should be_nil
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "store" do
|
57
|
+
|
58
|
+
before :each do
|
59
|
+
@storage_name = "another_test_storage"
|
60
|
+
@saver = Object.new
|
61
|
+
@saver.stub!(:perform)
|
62
|
+
described_class::Saver.stub!(:new).and_return(@saver)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should initialize the saver correctly" do
|
66
|
+
described_class::Saver.should_receive(:new).with(@object, @storage_name).and_return(@saver)
|
67
|
+
described_class.store @object, @storage_name
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should perform a store" do
|
71
|
+
@saver.should_receive(:perform)
|
72
|
+
described_class.store @object
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "remove" do
|
78
|
+
|
79
|
+
before :each do
|
80
|
+
@id = Object.new
|
81
|
+
GOM::Object::Id.stub!(:new).and_return(@id)
|
82
|
+
|
83
|
+
@remover = Object.new
|
84
|
+
@remover.stub!(:perform)
|
85
|
+
described_class::Remover.stub!(:new).and_return(@remover)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should initialize the remover correctly" do
|
89
|
+
described_class::Remover.should_receive(:new).with(@object).and_return(@remover)
|
90
|
+
described_class.remove @object
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should perform a remove" do
|
94
|
+
@remover.should_receive(:perform)
|
95
|
+
described_class.remove @object
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should convert a given string into an id" do
|
99
|
+
GOM::Object::Id.should_receive(:new).with("test_storage:object_1").and_return(@id)
|
100
|
+
described_class::Remover.should_receive(:new).with(@id).and_return(@remover)
|
101
|
+
described_class::remove "test_storage:object_1"
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|