diff options
Diffstat (limited to 'spec/unit/file_serving/content.rb')
| -rwxr-xr-x | spec/unit/file_serving/content.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/spec/unit/file_serving/content.rb b/spec/unit/file_serving/content.rb index a63f7efab..5441dff53 100755 --- a/spec/unit/file_serving/content.rb +++ b/spec/unit/file_serving/content.rb @@ -28,7 +28,8 @@ describe Puppet::FileServing::Content do File.stubs(:lstat).returns(stub("stat", :ftype => "file")) File.expects(:read).with("/path").returns result content.collect - content.content.should equal(result) + + content.instance_variable_get("@content").should_not be_nil end end @@ -58,4 +59,13 @@ describe Puppet::FileServing::Content, "when returning the contents" do File.expects(:read).with(@path).returns(:mycontent) @content.content.should == :mycontent end + + it "should cache the returned contents" do + File.expects(:stat).with(@path).returns stub("stat", :ftype => "file") + File.expects(:read).with(@path).returns(:mycontent) + @content.content + + # The second run would throw a failure if the content weren't being cached. + @content.content + end end |
