Skip to content

Commit

Permalink
updated readme, minor cleanups to commented-out code in core
Browse files Browse the repository at this point in the history
  • Loading branch information
kornysietsma committed Jun 6, 2011
1 parent 19c1dd5 commit 015854e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,16 @@ Phew! This may look complex, but it's a pretty common workflow for applications

## Testing

Testing is very rudimentary at the moment.
Testing is somewhat rudimentary - there are a few tests included, but they only test a few simple things.

Testing uses the wonderful [midje](https://github.com/marick/Midje#readme) library. To run tests, run

lein midje

Note that midje provides quite powerful mocking, using the 'provided' command - none of these tests need to actually call Twitter, the twitter API is mocked out.

I'm still a bit unsure how far to TDD clojure - it's obviously possible, but there's a lot of functionality that probably doesn't gain much from (unit) tests. Unless I define the whole namespace as a unit, and only mock external interfaces. Hmm...


## Other stuff

Expand Down
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## longer term
* refactor - several functions in core.clj are too long
* add some unit tests
* add more tests
* split main file up - though it's nice for examples to be a single file, it's a bit unstructured
* error handling!
* get rid of stateful sessions - we only write to the session from one spot, so could use default sessions instead of sandbar
Expand Down
6 changes: 2 additions & 4 deletions src/twitter_example/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,11 @@
(routes
(ANY "/auth/*" request
(if-let [oauth (session-get :twitter-oauth)]
(do
(println "calling handler on req " request " -> oauth" oauth)
(handler (assoc request :twitter-oauth oauth)))
(handler (assoc request :twitter-oauth oauth))
(let [request-token (twitter-request-token)
auth-url (callback-uri request-token)]
(session-put! :request-token request-token)
(-> (json-response {:message "twitter not authorized" :authUrl auth-url})
(-> (json-response {:authUrl auth-url})
(response/status 401)))))
handler)))

Expand Down

0 comments on commit 015854e

Please sign in to comment.