diff options
| author | Luke Kanies <luke@madstop.com> | 2007-10-04 17:07:47 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-10-04 17:07:47 -0500 |
| commit | 1fa591287a4ab921cec628aa0c5bf58d61fbdef2 (patch) | |
| tree | f6321fde5b3256b6d0752b91af971d08bdc0ed7f /spec/unit | |
| parent | 95b2b93290f619c20a1c2dca11dd9909477857f8 (diff) | |
Adding the integration tests to the Rakefile for spec,
fixing the integration tests, and extending the Classmethods
for the indirector so that indirected classes can set the
terminus class and cache class.
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/indirector/indirector.rb | 74 |
1 files changed, 41 insertions, 33 deletions
diff --git a/spec/unit/indirector/indirector.rb b/spec/unit/indirector/indirector.rb index 1702bf51f..5c3ddf9d3 100755 --- a/spec/unit/indirector/indirector.rb +++ b/spec/unit/indirector/indirector.rb @@ -50,37 +50,45 @@ describe Puppet::Indirector, "when registering an indirection" do end describe Puppet::Indirector, " when redirecting a model" do - before do - @thingie = Class.new do - extend Puppet::Indirector - end - @mock_terminus = mock('Terminus') - @indirection = @thingie.send(:indirects, :test) - @thingie.expects(:indirection).returns(@mock_terminus) - end - - it "should give the model the ability to lookup a model instance by letting the indirection perform the lookup" do - @mock_terminus.expects(:find) - @thingie.find - end - - it "should give the model the ability to remove model instances from a terminus by letting the indirection remove the instance" do - @mock_terminus.expects(:destroy) - @thingie.destroy - end - - it "should give the model the ability to search for model instances by letting the indirection find the matching instances" do - @mock_terminus.expects(:search) - @thingie.search - end - - it "should give the model the ability to store a model instance by letting the indirection store the instance" do - thing = @thingie.new - @mock_terminus.expects(:save).with(thing) - thing.save - end - - after do - @indirection.delete - end + before do + @thingie = Class.new do + extend Puppet::Indirector + end + @indirection = @thingie.send(:indirects, :test) + end + + it "should give the model the ability to lookup a model instance by letting the indirection perform the lookup" do + @indirection.expects(:find) + @thingie.find + end + + it "should give the model the ability to remove model instances from a terminus by letting the indirection remove the instance" do + @indirection.expects(:destroy) + @thingie.destroy + end + + it "should give the model the ability to search for model instances by letting the indirection find the matching instances" do + @indirection.expects(:search) + @thingie.search + end + + it "should give the model the ability to store a model instance by letting the indirection store the instance" do + thing = @thingie.new + @indirection.expects(:save).with(thing) + thing.save + end + + it "should give the model the ability to set the indirection terminus class" do + @indirection.expects(:terminus_class=).with(:myterm) + @thingie.terminus_class = :myterm + end + + it "should give the model the ability to set the indirection cache class" do + @indirection.expects(:cache_class=).with(:mycache) + @thingie.cache_class = :mycache + end + + after do + @indirection.delete + end end |
