corrected authorizations_controller_spec to assert on response codes

This commit is contained in:
danielgrippi 2011-06-29 17:10:43 -07:00
parent 144ac82577
commit 55efe132c5
2 changed files with 6 additions and 6 deletions

View file

@ -39,7 +39,7 @@ class AuthorizationsController < ApplicationController
message = verify(signed_string, Base64.decode64(params[:signature]), public_key, manifest) message = verify(signed_string, Base64.decode64(params[:signature]), public_key, manifest)
if not (message =='ok') if not (message =='ok')
render :text => message, :status => 403 render :text => message, :status => 403
elsif manifest["application_base_url"].match(/^https?:\/\/(localhost:\d+|chubbi\.es|www\.cubbi\.es|cubbi\.es)\/$/).nil? elsif manifest["application_base_url"].match(/^https?:\/\/(localhost|chubbi\.es|www\.cubbi\.es|cubbi\.es)(:\d+)?\/$/).nil?
# This will only be temporary (less than a month) while we iron out the kinks in Diaspora Connect. Essentially, # This will only be temporary (less than a month) while we iron out the kinks in Diaspora Connect. Essentially,
# whatever we release people will try to work off of and it sucks to build things on top of non-stable things. # whatever we release people will try to work off of and it sucks to build things on top of non-stable things.
# We also started writing a gem that we'll release (around the same time) that makes becoming a Diaspora enabled # We also started writing a gem that we'll release (around the same time) that makes becoming a Diaspora enabled

View file

@ -65,28 +65,28 @@ describe AuthorizationsController do
prepare_manifest("http://chubbi.es/") prepare_manifest("http://chubbi.es/")
@controller.stub!(:verify).and_return('ok') @controller.stub!(:verify).and_return('ok')
post :token, @params_hash post :token, @params_hash
response.body.blank?.should be_false response.code.should == "200"
end end
it 'renders something for cubbies ' do it 'renders something for cubbies ' do
prepare_manifest("http://cubbi.es/") prepare_manifest("http://cubbi.es/")
@controller.stub!(:verify).and_return('ok') @controller.stub!(:verify).and_return('ok')
post :token, @params_hash post :token, @params_hash
response.body.blank?.should be_false response.code.should == "200"
end end
it 'renders something for cubbies ' do it 'renders something for cubbies ' do
prepare_manifest("https://www.cubbi.es/") prepare_manifest("https://www.cubbi.es:443/")
@controller.stub!(:verify).and_return('ok') @controller.stub!(:verify).and_return('ok')
post :token, @params_hash post :token, @params_hash
response.body.blank?.should be_false response.code.should == "200"
end end
it 'renders something for localhost' do it 'renders something for localhost' do
prepare_manifest("http://localhost:3423/") prepare_manifest("http://localhost:3423/")
@controller.stub!(:verify).and_return('ok') @controller.stub!(:verify).and_return('ok')
post :token, @params_hash post :token, @params_hash
response.body.blank?.should be_false response.code.should == "200"
end end
it 'renders nothing for myspace' do it 'renders nothing for myspace' do