Skip to content

Commit

Permalink
Merge pull request #10 from andrestylianos/change-group-id
Browse files Browse the repository at this point in the history
Change groupId from gpm to greenpowermonitor
  • Loading branch information
trikitrok authored Apr 5, 2018
2 parents 4c3f1c9 + d576084 commit b1b010b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A small spying and stubbing library for Clojure and ClojureScript.

## Install

Add `[gpm/test-doubles "0.1.0"]` to `[:profiles :dev :dependencies]` in your `project.clj`.
Add `[greenpowermonitor/test-doubles "0.1.0"]` to `[:profiles :dev :dependencies]` in your `project.clj`.

## Usage

Expand All @@ -23,10 +23,10 @@ This option makes a function **return a given sequence of values in successive c
In the following example[<sup>2</sup>](#nota2), we stub the `rand` function to make it return four values in sequence, `1`, `4`, `6`, `3`. When you call `rand` more times than the number of values in the provided sequence, an exception gets thrown (see the message and data in the exception at the end of this test).

```clojure
(ns gpm.test-doubles.stubbing-with-returns-examples
(ns greenpowermonitor.test-doubles.stubbing-with-returns-examples
(:require
[clojure.test :refer [deftest testing is]]
[gpm.test-doubles.core :as td]))
[greenpowermonitor.test-doubles.core :as td]))

(deftest stubbing-functions-using-returns
(testing "make a function return a given sequence of values in successive calls"
Expand All @@ -52,10 +52,10 @@ This option makes a function **always return the same value**.

In the following example, we stub the `rand` function so that it always returns 1.
```clojure
(ns gpm.test-doubles.stubbing-with-constantly-examples
(ns greenpowermonitor.test-doubles.stubbing-with-constantly-examples
(:require
[clojure.test :refer [deftest testing is]]
[gpm.test-doubles.core :as td]))
[greenpowermonitor.test-doubles.core :as td]))

(deftest stubbing-functions-using-constantly
(testing "make a function return always the same value"
Expand Down Expand Up @@ -86,10 +86,10 @@ Notice how, in this last case, if you don't explicitly provide a value for any o
a `nil` will be returned when the received parameters don't match any of the map keys.

```clojure
(ns gpm.test-doubles.stubbing-with-maps-examples
(ns greenpowermonitor.test-doubles.stubbing-with-maps-examples
(:require
[clojure.test :refer [deftest testing is]]
[gpm.test-doubles.core :as td]))
[greenpowermonitor.test-doubles.core :as td]))

(defn do-some-computation-fn [_ _])

Expand Down Expand Up @@ -117,10 +117,10 @@ You can use the `:spying` option inside `with-doubles` macro to spy on all the c
In the following example, we spy the calls to `some-function` and `println` functions. Then we call twice `some-function` and three times `greetings-function` (which calls `println`). Finally, we use `calls-to` function to check
the calls to each spied function and the arguments passed to them in each call.
```clojure
(ns gpm.test-doubles.spying-examples
(ns greenpowermonitor.test-doubles.spying-examples
(:require
[clojure.test :refer [deftest testing is]]
[gpm.test-doubles.core :as td]))
[greenpowermonitor.test-doubles.core :as td]))

(defn- some-function [a b]
(println a b))
Expand Down Expand Up @@ -152,10 +152,10 @@ You can use the `:ignoring` option inside `with-doubles` macro to ignore all the

In the following example, even though you call the `double-print-x-and-greet` function inside `with-doubles`, nothing gets printed on the console because `greetings-function`and `print` get ignored.
```clojure
(ns gpm.test-doubles.stubbing-with-returns-examples
(ns greenpowermonitor.test-doubles.stubbing-with-returns-examples
(:require
[clojure.test :refer [deftest testing is]]
[gpm.test-doubles.core :as td]))
[greenpowermonitor.test-doubles.core :as td]))

(defn- greetings-function []
(println "Hola!"))
Expand Down
4 changes: 2 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject gpm/test-doubles "0.1.0"
(defproject greenpowermonitor/test-doubles "0.1.0"
:description "A small spying and stubbing library for Clojure and ClojureScript"
:url "https://github.com/GreenPowerMonitor/test-doubles"
:license {:name "Eclipse Public License"
Expand All @@ -17,6 +17,6 @@
:cljsbuild {:builds [{:id "unit-tests"
:source-paths ["src" "test"]
:compiler {:output-to "out/unit_tests.js"
:main gpm.test-doubles.unit-tests-runner
:main greenpowermonitor.test-doubles.unit-tests-runner
:target :nodejs
:optimizations :none}}]})
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns gpm.test-doubles.core
(ns greenpowermonitor.test-doubles.core
#?(:cljs (:require-macros
[gpm.test-doubles.core])))
[greenpowermonitor.test-doubles.core])))

(def ^:dynamic *spies-atom* (atom {}))

Expand Down
7 changes: 0 additions & 7 deletions test/gpm/test_doubles/unit_tests_runner.cljs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns gpm.test-doubles.core-test
(ns greenpowermonitor.test-doubles.core-test
(:require
[clojure.test :refer [deftest is testing]]
[gpm.test-doubles.core :as td]))
[greenpowermonitor.test-doubles.core :as td]))

(defn some-function [a b]
(println a b))
Expand Down
7 changes: 7 additions & 0 deletions test/greenpowermonitor/test_doubles/unit_tests_runner.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(ns greenpowermonitor.test-doubles.unit-tests-runner
(:require
[doo.runner :refer-macros [doo-tests]]
[greenpowermonitor.test-doubles.core-test]))

(doo-tests
'greenpowermonitor.test-doubles.core-test)

0 comments on commit b1b010b

Please sign in to comment.