Permalink
Browse files

Adding a sample contract.

  • Loading branch information...
1 parent 685dfe8 commit 19b3370f2d50d9e7eaaf6c6fd7e47f53099dd0c6 @gga committed Dec 19, 2011
Showing with 43 additions and 0 deletions.
  1. +43 −0 sample_contract.clj
View
43 sample_contract.clj
@@ -0,0 +1,43 @@
+(environment :dev (fn []))
+
+(service
+ (method :post)
+ (header "Content-Type" "application/json")
+
+ (before (fn [config]
+ ;; Perform a POST to authenticate, for example
+
+ (add-cookie config "SESSION" (-> :cookie-jar response (get "SESSION_ID")))
+ ))
+
+ (after (fn []))
+
+ (contract
+ "payment recipient list"
+ (definition
+ (url "/recipients"))
+
+ (clauses
+ (should_have :path "$..recipients" :of_type :array)
+ (should_have :path "$..recipients[*].name", :equal_to "")
+
+ (should_have :path "$.name", :matching #"\w+\w+")))
+
+ (conversation
+ "Creating a new send money transaction"
+
+ (contract
+ "create transaction"
+ :named submit_tx
+ (definition ...)
+ (clauses ...))
+
+ (contract
+ "verify transaction details"
+ (definition
+ (url "...")
+ (body {
+ :transactionid (:transaction_id submit_tx)}))
+
+ (clauses
+ (should_have :path "", :of_type :string)))))

0 comments on commit 19b3370

Please sign in to comment.