Merge branch 'develop' into task/upgrade-ruby

This commit is contained in:
Luke Barratt 2015-08-15 17:32:35 +01:00
commit 96167b55e4
4 changed files with 91 additions and 53 deletions

View file

@ -2,7 +2,6 @@ class PluginController < ApplicationController
def user
buffer = []
out = []
if ban = Ban.first(:conditions => ["expiry > UTC_TIMESTAMP() AND steamid = ? AND ban_type = ?", params[:id], Ban::TYPE_SERVER])
out << "#USER#"
out << "BANNED"
@ -31,7 +30,7 @@ class PluginController < ApplicationController
buffer << user.steamid
buffer << user.username
buffer << user.lastip
buffer << '0.0.0.0'
buffer << (user.team ? Verification.uncrap(user.team.to_s) : "No Team")
buffer << user.id
buffer << user.team_id

View file

@ -63,5 +63,5 @@ Ensl::Application.configure do
config.active_support.deprecation = :notify
# Custom Session Store config to allow gathers.staging.ensl.org
config.session_store :cookie_store, key: '_ENSL_session_key', expire_after: 30.days.to_i, domain: "gathers.ensl.org"
# config.session_store :cookie_store, key: '_ENSL_session_key', expire_after: 30.days.to_i, domain: "gathers.ensl.org"
end

View file

@ -0,0 +1,29 @@
require 'spec_helper'
describe PluginController do
render_views
describe '#user' do
before do
create :group, :donors
create :group, :champions
end
let!(:user) { create :user_with_team }
it 'returns user data' do
get :user, id: user.steamid
expect(response).to be_success
expect(response.body).to include(user.username)
end
it 'definitely does not return IP address' do
last_ip = '127.0.0.1'
user.lastip = last_ip
user.save!
get :user, id: user.steamid
expect(response).to be_success
expect(response).to_not include(last_ip)
end
end
end

View file

@ -9,4 +9,14 @@ FactoryGirl.define do
name "Admins"
id Group::ADMINS
end
trait :champions do
name "Champions"
id Group::CHAMPIONS
end
trait :donors do
name "Donors"
id Group::DONORS
end
end