diff options
author | danielsdeleo <dan@opscode.com> | 2013-01-24 07:59:53 -0800 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-01-24 07:59:53 -0800 |
commit | a89490bd552719f3cf3292e2068cdfdc1832a4f4 (patch) | |
tree | 326a54a36173c6beaa2e4eade030d9a9879b83bf /spec/unit/resource_spec.rb | |
parent | 05f1a225ae5d942f7c1460a61870bdbb854b82a3 (diff) | |
parent | c796763373e28f51d975c41a73336216cfafd948 (diff) | |
download | chef-a89490bd552719f3cf3292e2068cdfdc1832a4f4.tar.gz |
Merge branch 'CHEF-3068'
Diffstat (limited to 'spec/unit/resource_spec.rb')
-rw-r--r-- | spec/unit/resource_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 71d8a4cccf..ffcc7ae5b4 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -273,6 +273,29 @@ describe Chef::Resource do end end + describe "defined_at" do + it "should correctly parse source_line on unix-like operating systems" do + @resource.source_line = "/some/path/to/file.rb:80:in `wombat_tears'" + @resource.defined_at.should == "/some/path/to/file.rb line 80" + end + + it "should correctly parse source_line on Windows" do + @resource.source_line = "C:/some/path/to/file.rb:80 in 1`wombat_tears'" + @resource.defined_at.should == "C:/some/path/to/file.rb line 80" + end + + it "should include the cookbook and recipe when it knows it" do + @resource.source_line = "/some/path/to/file.rb:80:in `wombat_tears'" + @resource.recipe_name = "wombats" + @resource.cookbook_name = "animals" + @resource.defined_at.should == "animals::wombats line 80" + end + + it "should recognize dynamically defined resources" do + @resource.defined_at.should == "dynamically defined" + end + end + describe "to_s" do it "should become a string like resource_name[name]" do zm = Chef::Resource::ZenMaster.new("coffee") |