diff options
| author | Luke Kanies <luke@madstop.com> | 2008-08-25 17:43:35 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-08-26 22:40:41 -0700 |
| commit | 6ed8dfaf7c0cf091dca0374de310f524b0a033cc (patch) | |
| tree | 77c97024fe929c61d6efdf2b707b365c111b079c /spec | |
| parent | 92e144b3051ebd177c034e692a59162b3902e128 (diff) | |
Adding the content writer to the content class.
Also choosing a fully qualified fake name when creating
content instances from raw content.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/file_serving/content.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/unit/file_serving/content.rb b/spec/unit/file_serving/content.rb index 5441dff53..e471c3b29 100755 --- a/spec/unit/file_serving/content.rb +++ b/spec/unit/file_serving/content.rb @@ -17,6 +17,10 @@ describe Puppet::FileServing::Content do Puppet::FileServing::Content.indirection.metaclass.included_modules.should include(Puppet::FileServing::IndirectionHooks) end + it "should only support the raw format" do + Puppet::FileServing::Content.supported_formats.should == [:raw] + end + it "should have a method for collecting its attributes" do Puppet::FileServing::Content.new("/path").should respond_to(:collect) end @@ -31,6 +35,30 @@ describe Puppet::FileServing::Content do content.instance_variable_get("@content").should_not be_nil end + + it "should have a method for setting its content" do + content = Puppet::FileServing::Content.new("/path") + content.should respond_to(:content=) + end + + it "should make content available when set externally" do + content = Puppet::FileServing::Content.new("/path") + content.content = "foo/bar" + content.content.should == "foo/bar" + end + + it "should be able to create a content instance from raw file contents" do + Puppet::FileServing::Content.should respond_to(:from_raw) + end + + it "should create an instance with a fake file name and correct content when converting from raw" do + instance = mock 'instance' + Puppet::FileServing::Content.expects(:new).with("/this/is/a/fake/path").returns instance + + instance.expects(:content=).with "foo/bar" + + Puppet::FileServing::Content.from_raw("foo/bar").should equal(instance) + end end describe Puppet::FileServing::Content, "when returning the contents" do |
