diff options
author | Claire McQuin <claire@getchef.com> | 2014-08-07 11:33:01 -0700 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2014-08-12 09:48:12 -0700 |
commit | 605d5b7e51840862d2376726746f30f90054a316 (patch) | |
tree | 4890501bec49c4d97160599093f98714e57d710b /spec/unit/resource_spec.rb | |
parent | 5ded6f5aaa5998b64665566d6fca85add7cecd15 (diff) | |
download | chef-605d5b7e51840862d2376726746f30f90054a316.tar.gz |
Ensure reported elapsed_time is nonnegative.
Diffstat (limited to 'spec/unit/resource_spec.rb')
-rw-r--r-- | spec/unit/resource_spec.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index dd6d58630f..7cb2badb2e 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -344,7 +344,7 @@ describe Chef::Resource do expected_keys = [ :allowed_actions, :params, :provider, :updated, :updated_by_last_action, :before, :supports, :noop, :ignore_failure, :name, :source_line, - :action, :retries, :retry_delay, :elapsed_time, + :action, :retries, :retry_delay, :elapsed_time, :guard_interpreter, :sensitive ] (hash.keys - expected_keys).should == [] (expected_keys - hash.keys).should == [] @@ -527,6 +527,12 @@ describe Chef::Resource do snitch_var2.should be_false end + it "reports 0 elapsed time if actual elapsed time is < 0" do + Time.stub(:now).and_return(0, -1) + @resource.run_action(:purr) + @resource.elapsed_time.should == 0 + end + describe "guard_interpreter attribute" do let(:resource) { @resource } @@ -788,7 +794,7 @@ describe Chef::Resource do before(:each) do @resource_file = Chef::Resource::File.new("/nonexistent/CHEF-5098/file", @run_context) @action = :create - end + end def compiled_resource_data(resource, action, err) error_inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(resource, action, err) |