Fix Maintainers spec for anons
it doesn't create guest user now, and relies on anonymous_access config variable instead.
This commit is contained in:
parent
a5b3a01156
commit
629e227d9a
|
@ -2,7 +2,9 @@
|
|||
class Platforms::MaintainersController < ApplicationController
|
||||
# External callbacks from bugzilla
|
||||
ET_CALLBACKS = [:assignee]
|
||||
|
||||
before_filter :authenticate_user!, :except => ET_CALLBACKS
|
||||
skip_before_filter :authenticate_user!, :only => [:index] if APP_CONFIG['anonymous_access']
|
||||
load_and_authorize_resource :platform, :except => ET_CALLBACKS
|
||||
|
||||
# external callbacks are authorized with a lightweight scheme: they should only come from a specified IP addresses
|
||||
|
|
|
@ -2,18 +2,23 @@
|
|||
require 'spec_helper'
|
||||
|
||||
shared_examples_for 'guest user' do
|
||||
before(:each) do
|
||||
unless APP_CONFIG['anonymous_access']
|
||||
@user = FactoryGirl.create(:user)
|
||||
set_session_for(@user)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Only one action for now here
|
||||
[:index].each do |action|
|
||||
it "should be able to perform #{ action } action" do
|
||||
get action, :platform_id => @platform.id
|
||||
response.should be_success
|
||||
guest_actions = [:index]
|
||||
|
||||
if APP_CONFIG['anonymous_access']
|
||||
guest_actions.each do |action|
|
||||
it "should be able to perform #{ action } action" do
|
||||
get action, :platform_id => @platform.id
|
||||
response.should be_success
|
||||
end
|
||||
end
|
||||
else # non-anonymous access
|
||||
guest_actions.each do |action|
|
||||
it "should not be able to perform #{ action } action" do
|
||||
get action, :platform_id => @platform.id
|
||||
response.should redirect_to(new_user_session_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue