added 3 invalid status message specs
This commit is contained in:
parent
e8933fa1da
commit
88bb3403d8
2 changed files with 23 additions and 5 deletions
|
|
@ -65,14 +65,15 @@ class StatusMessagesController < ApplicationController
|
|||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back}
|
||||
format.mobile{ redirect_to stream_path}
|
||||
format.json{ render :json => @status_message.as_api_response(:backbone), :status => 201 }
|
||||
format.html { redirect_to :back }
|
||||
format.mobile { redirect_to stream_path }
|
||||
format.json { render :json => @status_message.as_api_response(:backbone), :status => 201 }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.json { render :nothing => true , :status => 403 }
|
||||
format.html { redirect_to :back }
|
||||
format.mobile { redirect_to stream_path }
|
||||
format.json { render :nothing => true , :status => 403 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -80,7 +80,13 @@ describe StatusMessagesController do
|
|||
}
|
||||
|
||||
it 'creates with valid html' do
|
||||
post :create, status_message_hash.merge(:format => 'html')
|
||||
post :create, status_message_hash
|
||||
response.status.should == 302
|
||||
response.should be_redirect
|
||||
end
|
||||
|
||||
it 'creates with invalid html' do
|
||||
post :create, status_message_hash.merge(:status_message => { :text => "0123456789" * 7000 })
|
||||
response.status.should == 302
|
||||
response.should be_redirect
|
||||
end
|
||||
|
|
@ -90,12 +96,23 @@ describe StatusMessagesController do
|
|||
response.status.should == 201
|
||||
end
|
||||
|
||||
it 'creates with invalid json' do
|
||||
post :create, status_message_hash.merge(:status_message => { :text => "0123456789" * 7000 }, :format => 'json')
|
||||
response.status.should == 403
|
||||
end
|
||||
|
||||
it 'creates with valid mobile' do
|
||||
post :create, status_message_hash.merge(:format => 'mobile')
|
||||
response.status.should == 302
|
||||
response.should be_redirect
|
||||
end
|
||||
|
||||
it 'creates with invalid mobile' do
|
||||
post :create, status_message_hash.merge(:status_message => { :text => "0123456789" * 7000 }, :format => 'mobile')
|
||||
response.status.should == 302
|
||||
response.should be_redirect
|
||||
end
|
||||
|
||||
it 'removes getting started from new users' do
|
||||
@controller.should_receive(:remove_getting_started)
|
||||
post :create, status_message_hash
|
||||
|
|
|
|||
Loading…
Reference in a new issue