blob: 0d90171008caf67ddc1a65317dc92aeb18c16ea3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
shared_examples_for "A Memory Terminus" do
it "should find no instances by default" do
@searcher.find(@request).should be_nil
end
it "should be able to find instances that were previously saved" do
@searcher.save(@request)
@searcher.find(@request).should equal(@instance)
end
it "should replace existing saved instances when a new instance with the same name is saved" do
@searcher.save(@request)
two = stub 'second', :name => @name
trequest = stub 'request', :key => @name, :instance => two
@searcher.save(trequest)
@searcher.find(@request).should equal(two)
end
it "should be able to remove previously saved instances" do
@searcher.save(@request)
@searcher.destroy(@request)
@searcher.find(@request).should be_nil
end
it "should fail when asked to destroy an instance that does not exist" do
proc { @searcher.destroy(@request) }.should raise_error(ArgumentError)
end
end
|