2012-10-02 17:54:55 +01:00
|
|
|
# -*- encoding : utf-8 -*-
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe AutocompletesController do
|
2012-12-17 15:44:14 +00:00
|
|
|
before {stub_symlink_methods}
|
2012-10-02 17:54:55 +01:00
|
|
|
|
|
|
|
context 'for user' do
|
|
|
|
before do
|
|
|
|
set_session_for(FactoryGirl.create(:user))
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should be able to perform autocomplete_group_uname action' do
|
|
|
|
get :autocomplete_group_uname
|
|
|
|
response.should be_success
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should be able to perform autocomplete_user_uname action' do
|
|
|
|
get :autocomplete_user_uname
|
|
|
|
response.should be_success
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'for guest' do
|
|
|
|
|
|
|
|
before do
|
|
|
|
set_session_for(User.new)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not be able to perform autocomplete_group_uname action' do
|
|
|
|
get :autocomplete_group_uname
|
|
|
|
response.should redirect_to(new_user_session_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not be able to perform autocomplete_user_uname action' do
|
|
|
|
get :autocomplete_user_uname
|
|
|
|
response.should redirect_to(new_user_session_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|