From 17917528f62147c51d908b97ab24e0c47d44d807 Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Mon, 27 Jun 2011 12:31:47 -0700 Subject: IZ, RS, Move AS::Photo controller spec into integration so that rack middleware is run. Make auth failure return 401 rather than 302. --- .../activity_streams/photos_controller_spec.rb | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 spec/integration/activity_streams/photos_controller_spec.rb (limited to 'spec/integration/activity_streams') diff --git a/spec/integration/activity_streams/photos_controller_spec.rb b/spec/integration/activity_streams/photos_controller_spec.rb new file mode 100644 index 000000000..e95a3ae4e --- /dev/null +++ b/spec/integration/activity_streams/photos_controller_spec.rb @@ -0,0 +1,58 @@ +require 'spec_helper' + +describe ActivityStreams::PhotosController do + describe '#create' do + before do + @json = JSON.parse < token.access_token) + response.should be_success + end + + it 'denies an invalid oauth token' do + post @url, @json.merge!(:oauth_token => "aoijgosidjg") + response.status.should == 401 + response.body.should be_empty + end + + it 'allows token authentication' do + bob.reset_authentication_token! + post @url, @json.merge!(:auth_token => bob.authentication_token) + response.should be_success + end + + it 'correctly denies an invalid token' do + post @url, @json.merge!(:auth_token => "iudsfghpsdifugh") + response.status.should == 401 + end + end +end -- cgit v1.2.3