You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

68 lines
3.2 KiB

;
; Copyright © 2021 Stephen Starkey
;
; This file is part of Freefrog.
;
; Freefrog is free software: you can redistribute it and/or modify
; it under the terms of the GNU Affero General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; Freefrog is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU Affero General Public License for more details.
;
; You should have received a copy of the GNU Affero General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
(ns freefrog.render-spec
(:require [freefrog.governance :as g]
[freefrog.render :as render]
[java-time :refer [local-date]]
[speclj.core :refer :all]))
(def simple-circle (-> (g/create-circle "simple circle")
(g/update-purpose "Simplicity")
(g/add-role-to-circle "role 1" "rocking")
(g/add-role-accountability "role 1" "doing basic things")
(g/add-role-to-circle "role 2" "being #2"
["dom1" "dom2"]
["acc1" "acc2"])
(g/add-policy "basic policy" "you can do things")
(g/add-role-policy "role 2" "basic role policy"
"you also can do things")
(g/add-role-to-circle "role 3")
(g/add-role-accountability "role 3"
"other basic things")
(g/appoint-to-role "role 2" "larry")
(g/appoint-to-role "role 2" "george" "some stuff")
(g/elect-to-role g/facilitator-name "phil"
(local-date 2014 01 01))
(g/elect-to-role g/secretary-name "larry"
(local-date 2014 01 01))
(g/convert-to-circle "role 3")
(g/update-subcircle ["role 3"] g/add-role-to-circle
"test")))
(describe "Simple circle"
(it "should render the basics of a circle"
(should= "# simple circle #\nSimplicity\n
Facilitator: phil, expiring 2014-01-01
Secretary: larry, expiring 2014-01-01\n
## Policies ##\n\n 0. basic policy\n
## Roles ##\n\n 0. role 1\n 1. role 2\n 2. role 3\n"
(render/markdown-role simple-circle))
(should= "# role 1 #\nrocking\n
## Accountabilities ##\n\n * doing basic things\n"
(render/markdown-role (g/get-role simple-circle "role 1")))
(should=
"# role 2 #\nbeing #2\n\n## Domains ##\n\n * dom1\n * dom2\n
## Accountabilities ##\n\n * acc1\n * acc2\n\n## Policies ##\n
0. basic role policy\n\n## Assignees ##\n
* larry\n * george, for some stuff \n"
(render/markdown-role (g/get-role simple-circle "role 2")))
(should= "# role 3 #\n\n## Accountabilities ##\n\n * other basic things\n
## Roles ##\n\n 0. test\n"
(render/markdown-role (g/get-role simple-circle "role 3")))))