Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
mock_model stubs destroyed? to return false
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Dec 3, 2009
1 parent a4ee241 commit 48e91f6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions History.rdoc
Expand Up @@ -20,6 +20,7 @@
* no error if either action or template exist
* error if neither exist
* Closes #888.
* mock_model stubs destroyed? to return false

* removals
* spec_server has been removed in favor of spork.
Expand Down
1 change: 1 addition & 0 deletions lib/spec/rails/mocks.rb
Expand Up @@ -14,6 +14,7 @@ def mock_model(model_class, options_and_stubs = {})
:id => id,
:to_param => id.to_s,
:new_record? => false,
:destroyed? => false,
:errors => stub("errors", :count => 0)
})
m = mock("#{model_class.name}_#{id}", options_and_stubs)
Expand Down
3 changes: 3 additions & 0 deletions spec/spec/rails/mocks/mock_model_spec.rb
Expand Up @@ -24,6 +24,9 @@
it "should not say it instance_of? if it isn't, even if it's ancestor is" do
@model.instance_of?(MockableModel).should be(false)
end
it "should say it is not destroyed" do
@model.destroyed?(SubMockableModel).should be(false)
end
end

describe "with params" do
Expand Down

0 comments on commit 48e91f6

Please sign in to comment.