started writing tests for user.log_out method but I have a few questions...

@SamSaffron This is not ready to be merged in yet, just letting you know I'm working on this and that I have a few questions.

## (1) How should I test for success if the response body is blank?

    def log_out
      @user.auth_token = nil
      @user.save!
      MessageBus.publish "/logout", @user.id, user_ids: [@user.id]
      render nothing: true
    end

I'm assuming it's because it's being added to the message bus and so the last line `render nothing: true` needs to be there.

As you can see from the screen shot below the post request is successful, but the body is empty so I can't actually check it's success status:

![screen shot 2014-11-27 at 7 33 01 am](https://cloud.githubusercontent.com/assets/1490496/5218235/bf18b636-7607-11e4-9e45-34274c205a9e.png)

***

## (2) I'm getting a 500 Internal Server Error if I pass in a user_id that doesn't exist

I also started to write a failing test if I passed in an incorrect user_id, and then I get this nasty message in return. 

    /Users/blake/code/discourse_api/lib/discourse_api/client.rb:66:in `post': NoMethodError at  /admin/users/90/log_out (DiscourseApi::ApiError)

> undefined method `auth_token=' for nil:NilClass

app/controllers/admin/users_controller.rb, line 69
--------------------------------------------------

``` ruby
   64       StaffActionLogger.new(current_user).log_user_unsuspend(@user)
   65       render nothing: true
   66     end
   67   
   68     def log_out
>  69       @user.auth_token = nil
   70       @user.save!
   71       MessageBus.publish "/logout", @user.id, user_ids: [@user.id]
   72       render nothing: true
   73     end
   74   
```

App backtrace
-------------

 - app/controllers/admin/users_controller.rb:69:in `log_out'
 - config/initializers/quiet_logger.rb:10:in `call_with_quiet_assets'
 - config/initializers/silence_logger.rb:26:in `call'
 - lib/middleware/missing_avatars.rb:21:in `call'
 - lib/middleware/turbo_dev.rb:32:in `call'

Full backtrace
--------------

 - app/controllers/admin/users_controller.rb:69:in `log_out'
 - actionpack (4.1.8) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
 - actionpack (4.1.8) lib/abstract_controller/base.rb:189:in `process_action'
 - actionpack (4.1.8) lib/action_controller/metal/rendering.rb:10:in `process_action'
 - actionpack (4.1.8) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:113:in `call'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:229:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:86:in `run_callbacks'
 - actionpack (4.1.8) lib/abstract_controller/callbacks.rb:19:in `process_action'
 - actionpack (4.1.8) lib/action_controller/metal/rescue.rb:29:in `process_action'
 - actionpack (4.1.8) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
 - activesupport (4.1.8) lib/active_support/notifications.rb:159:in `block in instrument'
 - activesupport (4.1.8) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
 - activesupport (4.1.8) lib/active_support/notifications.rb:159:in `instrument'
 - actionpack (4.1.8) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
 - actionpack (4.1.8) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
 - activerecord (4.1.8) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
 - actionpack (4.1.8) lib/abstract_controller/base.rb:136:in `process'
 - actionview (4.1.8) lib/action_view/rendering.rb:30:in `process'
 - rack-mini-profiler (0.9.2) lib/mini_profiler/profiling_methods.rb:108:in `block in profile_method'
 - actionpack (4.1.8) lib/action_controller/metal.rb:196:in `dispatch'
 - actionpack (4.1.8) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
 - actionpack (4.1.8) lib/action_controller/metal.rb:232:in `block in action'
 - actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:82:in `dispatch'
 - actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:50:in `call'
 - actionpack (4.1.8) lib/action_dispatch/routing/mapper.rb:45:in `call'
 - actionpack (4.1.8) lib/action_dispatch/journey/router.rb:73:in `block in call'
 - actionpack (4.1.8) lib/action_dispatch/journey/router.rb:59:in `call'
 - actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:678:in `call'
 - rack-protection (1.5.3) lib/rack/protection/frame_options.rb:31:in `call'
 - omniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'
 - omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'
 - omniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'
 - omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'
 - omniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'
 - omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'
 - omniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'
 - omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'
 - omniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'
 - omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'
 - omniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'
 - omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'
 - omniauth (1.2.2) lib/omniauth/builder.rb:59:in `call'
 - rack (1.5.2) lib/rack/conditionalget.rb:35:in `call'
 - rack (1.5.2) lib/rack/head.rb:11:in `call'
 - actionpack (4.1.8) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
 - actionpack (4.1.8) lib/action_dispatch/middleware/flash.rb:254:in `call'
 - message_bus (1.0.5) lib/message_bus/rack/middleware.rb:55:in `call'
 - rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
 - rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
 - actionpack (4.1.8) lib/action_dispatch/middleware/cookies.rb:560:in `call'
 - activerecord (4.1.8) lib/active_record/query_cache.rb:36:in `call'
 - activerecord (4.1.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
 - activerecord (4.1.8) lib/active_record/migration.rb:380:in `call'
 - actionpack (4.1.8) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
 - activesupport (4.1.8) lib/active_support/callbacks.rb:82:in `run_callbacks'
 - actionpack (4.1.8) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
 - actionpack (4.1.8) lib/action_dispatch/middleware/reloader.rb:73:in `call'
 - actionpack (4.1.8) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
 - better_errors (2.0.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
 - better_errors (2.0.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
 - better_errors (2.0.0) lib/better_errors/middleware.rb:57:in `call'
 - actionpack (4.1.8) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
 - actionpack (4.1.8) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
 - logster (0.1.6) lib/logster/middleware/reporter.rb:23:in `call'
 - railties (4.1.8) lib/rails/rack/logger.rb:38:in `call_app'
 - railties (4.1.8) lib/rails/rack/logger.rb:22:in `call'
 - config/initializers/quiet_logger.rb:10:in `call_with_quiet_assets'
 - config/initializers/silence_logger.rb:26:in `call'
 - actionpack (4.1.8) lib/action_dispatch/middleware/request_id.rb:21:in `call'
 - rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
 - rack (1.5.2) lib/rack/runtime.rb:17:in `call'
 - actionpack (4.1.8) lib/action_dispatch/middleware/static.rb:84:in `call'
 - rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
 - lib/middleware/missing_avatars.rb:21:in `call'
 - lib/middleware/turbo_dev.rb:32:in `call'
 - rack-mini-profiler (0.9.2) lib/mini_profiler/profiler.rb:300:in `call'
 - railties (4.1.8) lib/rails/engine.rb:514:in `call'
 - railties (4.1.8) lib/rails/application.rb:144:in `call'
 - railties (4.1.8) lib/rails/railtie.rb:194:in `method_missing'
 - rack (1.5.2) lib/rack/builder.rb:138:in `call'
 - rack (1.5.2) lib/rack/urlmap.rb:65:in `block in call'
 - rack (1.5.2) lib/rack/urlmap.rb:50:in `call'
 - rack (1.5.2) lib/rack/content_length.rb:14:in `call'
 - thin (1.6.2) lib/thin/connection.rb:86:in `block in pre_process'
 - thin (1.6.2) lib/thin/connection.rb:84:in `pre_process'
 - thin (1.6.2) lib/thin/connection.rb:53:in `process'
 - thin (1.6.2) lib/thin/connection.rb:39:in `receive_data'
 - eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
 - thin (1.6.2) lib/thin/backends/base.rb:73:in `start'
 - thin (1.6.2) lib/thin/server.rb:162:in `start'
 - rack (1.5.2) lib/rack/handler/thin.rb:16:in `run'
 - rack (1.5.2) lib/rack/server.rb:264:in `start'
 - railties (4.1.8) lib/rails/commands/server.rb:69:in `start'
 - railties (4.1.8) lib/rails/commands/commands_tasks.rb:81:in `block in server'
 - railties (4.1.8) lib/rails/commands/commands_tasks.rb:76:in `server'
 - railties (4.1.8) lib/rails/commands/commands_tasks.rb:40:in `run_command!'
 - railties (4.1.8) lib/rails/commands.rb:17:in `<top (required)>'
 - bin/rails:4:in `<main>'

	from /Users/blake/code/discourse_api/lib/discourse_api/api/users.rb:42:in `log_out'
	from app.rb:23:in `<main>'

I don't think this is what should be happening if I pass in a user_id that doesn't exist. Discourse should probably return a 404 request not found?

Let me know what you think about these two questions and maybe it is something I can work on and send a pull request to the discourse project?