From 91c67fa9d79f0a7fa5cc6a99b9288a94bfaed6f5 Mon Sep 17 00:00:00 2001 From: Josh Eversmann Date: Fri, 28 Oct 2016 17:52:41 -0500 Subject: [PATCH] Add documentation for getters and setters --- resources/docs/spies-intro.md | 1 + resources/docs/stubs.edn | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/resources/docs/spies-intro.md b/resources/docs/spies-intro.md index 6326bf9..5605fd5 100644 --- a/resources/docs/spies-intro.md +++ b/resources/docs/spies-intro.md @@ -68,6 +68,7 @@ contrived example: original method in all cases. The original method can be restored by calling object.method.restore(). The returned spy is the function object which replaced the original method. spy === object.method. + This method also works on getters and setters. diff --git a/resources/docs/stubs.edn b/resources/docs/stubs.edn index 8bdbec9..70fd95e 100644 --- a/resources/docs/stubs.edn +++ b/resources/docs/stubs.edn @@ -15,6 +15,10 @@ :description "Replaces `object.method` with a `func`, wrapped in a `spy`. As usual, `object.method.restore();` can be used to restore the original method."} + {:name "var stub = sinon.stub(object, \"getter\", property);" + :description "Replaces `object.getter` with a new function which returns + `property`, also wrapped in a `spy`. As usual, `object.method.restore();` + can be used to restore the original method."} {:name "var stub = sinon.stub(obj);" :description "Stubs all the object's methods. Note that it's usually better practice to stub individual methods, particularly on