diff options
author | Francis Irving <francis@mysociety.org> | 2010-10-18 11:37:00 +0100 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2010-10-18 11:37:00 +0100 |
commit | af082f6079aff2181e1aa1fe805a1f96cae30c86 (patch) | |
tree | c644074d80a8ca912591b8d62003c4bf01e00500 /spec/controllers/user_controller_spec.rb | |
parent | 325114fee9b58ba7512de5448a7a1cc604541a75 (diff) |
Test for users.
Diffstat (limited to 'spec/controllers/user_controller_spec.rb')
-rw-r--r-- | spec/controllers/user_controller_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index adc52303e..76893c560 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -1,5 +1,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'json' + # XXX Use route_for or params_from to check /c/ links better # http://rspec.rubyforge.org/rspec-rails/1.1.12/classes/Spec/Rails/Example/ControllerExampleGroup.html @@ -503,3 +505,22 @@ describe UserController, "when using profile photos" do # XXX todo check the two stage javascript cropping (above only tests one stage non-javascript one) end +describe UserController, "when showing JSON version for API" do + + fixtures :users + + it "should be successful" do + get :show, :url_name => "bob_smith", :format => "json" + + u = JSON.parse(response.body) + u.class.to_s.should == 'Hash' + + u['url_name'].should == 'bob_smith' + u['name'].should == 'Bob Smith' + end + +end + + + + |