mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-25 12:01:03 +00:00
Fix styling
This commit is contained in:
parent
57e0c27f98
commit
3ba0eb8c8b
12 changed files with 100 additions and 100 deletions
|
@ -17,8 +17,8 @@ class MatchesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def admin
|
def admin
|
||||||
@matches = Match.active.includes(:contest, :contester1, :contester2, :map1, :map2, :referee).
|
@matches = Match.active.includes(:contest, :contester1, :contester2, :map1, :map2, :referee)
|
||||||
all.group_by { |t| t.week.to_s }.to_a.reverse
|
.all.group_by { |t| t.week.to_s }.to_a.reverse
|
||||||
render layout: "full"
|
render layout: "full"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ module Verification
|
||||||
# TODO: rikki?
|
# TODO: rikki?
|
||||||
# Returns true if params (or its keys if a hash) are a subset of filter
|
# Returns true if params (or its keys if a hash) are a subset of filter
|
||||||
def self.contain(params, filter)
|
def self.contain(params, filter)
|
||||||
keys = (params.instance_of?(Array) ? params : params.keys).map { |k| k.to_sym }
|
keys = (params.instance_of?(Array) ? params : params.keys).map(&:to_sym)
|
||||||
(keys - filter).empty?
|
(keys - filter).empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
14
spec/controllers/api/v1/maps_controller_spec.rb
Normal file → Executable file
14
spec/controllers/api/v1/maps_controller_spec.rb
Normal file → Executable file
|
@ -1,19 +1,19 @@
|
||||||
require 'spec_helper'
|
require "spec_helper"
|
||||||
|
|
||||||
describe Api::V1::MapsController do
|
describe Api::V1::MapsController do
|
||||||
before do
|
before do
|
||||||
request.accept = 'application/json'
|
request.accept = "application/json"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#index' do
|
describe "#index" do
|
||||||
let!(:map) { create :map }
|
let!(:map) { create :map }
|
||||||
|
|
||||||
it 'returns a list of maps' do
|
it "returns a list of maps" do
|
||||||
get :index
|
get :index
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
expect(json['maps'].length).to eq(1)
|
expect(json["maps"].length).to eq(1)
|
||||||
json_map = json['maps'][0]
|
json_map = json["maps"][0]
|
||||||
expect(json_map['id']).to eq(map.id)
|
expect(json_map["id"]).to eq(map.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
14
spec/controllers/api/v1/servers_controller_spec.rb
Normal file → Executable file
14
spec/controllers/api/v1/servers_controller_spec.rb
Normal file → Executable file
|
@ -1,20 +1,20 @@
|
||||||
require 'spec_helper'
|
require "spec_helper"
|
||||||
|
|
||||||
describe Api::V1::ServersController do
|
describe Api::V1::ServersController do
|
||||||
before do
|
before do
|
||||||
request.accept = 'application/json'
|
request.accept = "application/json"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#index' do
|
describe "#index" do
|
||||||
let!(:server) { create :server, :active }
|
let!(:server) { create :server, :active }
|
||||||
let!(:inactive_server) { create :server, :inactive }
|
let!(:inactive_server) { create :server, :inactive }
|
||||||
|
|
||||||
it 'returns a list of servers' do
|
it "returns a list of servers" do
|
||||||
get :index
|
get :index
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
expect(json['servers'].length).to eq(1)
|
expect(json["servers"].length).to eq(1)
|
||||||
json_server = json['servers'][0]
|
json_server = json["servers"][0]
|
||||||
expect(json_server['id']).to eq(server.id)
|
expect(json_server["id"]).to eq(server.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
14
spec/controllers/plugin/plugin_controller_spec.rb
Normal file → Executable file
14
spec/controllers/plugin/plugin_controller_spec.rb
Normal file → Executable file
|
@ -1,9 +1,9 @@
|
||||||
require 'spec_helper'
|
require "spec_helper"
|
||||||
|
|
||||||
describe PluginController do
|
describe PluginController do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
describe '#user' do
|
describe "#user" do
|
||||||
before do
|
before do
|
||||||
create :group, :donors
|
create :group, :donors
|
||||||
create :group, :champions
|
create :group, :champions
|
||||||
|
@ -11,19 +11,19 @@ describe PluginController do
|
||||||
|
|
||||||
let!(:user) { create :user_with_team }
|
let!(:user) { create :user_with_team }
|
||||||
|
|
||||||
it 'returns user data' do
|
it "returns user data" do
|
||||||
get :user, id: user.steamid
|
get :user, id: user.steamid
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
expect(response.body).to include(user.username)
|
expect(response.body).to include(user.username)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'definitely does not return IP address' do
|
it "definitely does not return IP address" do
|
||||||
last_ip = '127.0.0.1'
|
last_ip = "127.0.0.1"
|
||||||
user.lastip = last_ip
|
user.lastip = last_ip
|
||||||
user.save!
|
user.save!
|
||||||
get :user, id: user.steamid
|
get :user, id: user.steamid
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
expect(response).to_not include(last_ip)
|
expect(response).to_not include(last_ip)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
58
spec/features/shoutbox/shoutbox_spec.rb
Normal file → Executable file
58
spec/features/shoutbox/shoutbox_spec.rb
Normal file → Executable file
|
@ -1,34 +1,34 @@
|
||||||
require 'spec_helper'
|
require "spec_helper"
|
||||||
|
|
||||||
feature 'Shoutbox', js: true do
|
feature "Shoutbox", js: true do
|
||||||
let!(:user) { create :user }
|
let!(:user) { create :user }
|
||||||
|
|
||||||
background do
|
background do
|
||||||
sign_in_as user
|
sign_in_as user
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'creating a valid shout' do
|
scenario "creating a valid shout" do
|
||||||
visit root_path
|
visit root_path
|
||||||
shout = rand(100000).to_s
|
shout = rand(100_000).to_s
|
||||||
fill_in 'shoutbox_text', with: shout
|
fill_in "shoutbox_text", with: shout
|
||||||
click_button 'Shout!'
|
click_button "Shout!"
|
||||||
expect(page).to have_content(shout)
|
expect(page).to have_content(shout)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'enter more than 100 characters' do
|
scenario "enter more than 100 characters" do
|
||||||
valid_shout = 100.times.map { "a" }.join
|
valid_shout = 100.times.map { "a" }.join
|
||||||
invalid_shout = 101.times.map { "a" }.join
|
invalid_shout = 101.times.map { "a" }.join
|
||||||
visit root_path
|
visit root_path
|
||||||
expect(page).to_not have_content("Maximum shout length exceeded")
|
expect(page).to_not have_content("Maximum shout length exceeded")
|
||||||
fill_in 'shoutbox_text', with: invalid_shout
|
fill_in "shoutbox_text", with: invalid_shout
|
||||||
expect(page).to have_content("Maximum shout length exceeded")
|
expect(page).to have_content("Maximum shout length exceeded")
|
||||||
fill_in 'shoutbox_text', with: valid_shout
|
fill_in "shoutbox_text", with: valid_shout
|
||||||
expect(page).to_not have_content("Maximum shout length exceeded")
|
expect(page).to_not have_content("Maximum shout length exceeded")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'creating shout while banned' do
|
scenario "creating shout while banned" do
|
||||||
Ban.create! ban_type: Ban::TYPE_MUTE, expiry: Time.now + 10.days, user_name: user.username
|
Ban.create! ban_type: Ban::TYPE_MUTE, expiry: Time.now.utc + 10.days, user_name: user.username
|
||||||
visit root_path
|
visit root_path
|
||||||
expect(find("#sidebar")).to have_content "You have been muted."
|
expect(find("#sidebar")).to have_content "You have been muted."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
22
spec/features/users/case_insensitive_login_spec.rb
Normal file → Executable file
22
spec/features/users/case_insensitive_login_spec.rb
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
require 'spec_helper'
|
require "spec_helper"
|
||||||
|
|
||||||
feature 'Case insensitive login', js: :true do
|
feature "Case insensitive login", js: :true do
|
||||||
let(:username) { "CaSe_InSeNsItIvE" }
|
let(:username) { "CaSe_InSeNsItIvE" }
|
||||||
let(:password) { "passwordABC123" }
|
let(:password) { "passwordABC123" }
|
||||||
let!(:user) { create(:user, username: username, raw_password: password) }
|
let!(:user) { create(:user, username: username, raw_password: password) }
|
||||||
|
@ -9,23 +9,23 @@ feature 'Case insensitive login', js: :true do
|
||||||
visit root_path
|
visit root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
feature 'when a user with mixed-case username signs in' do
|
feature "when a user with mixed-case username signs in" do
|
||||||
scenario 'with a matching case allows the user to sign in' do
|
scenario "with a matching case allows the user to sign in" do
|
||||||
fill_login_form(username)
|
fill_login_form(username)
|
||||||
click_button submit(:user, :login)
|
click_button submit(:user, :login)
|
||||||
|
|
||||||
expect(page).to have_content(I18n.t('login_successful'))
|
expect(page).to have_content(I18n.t("login_successful"))
|
||||||
|
|
||||||
within user_status do
|
within user_status do
|
||||||
expect(page).to have_content(account_link)
|
expect(page).to have_content(account_link)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'with a non-matching case allows the user to sign in' do
|
scenario "with a non-matching case allows the user to sign in" do
|
||||||
fill_login_form("CASE_INSENSITIVE")
|
fill_login_form("CASE_INSENSITIVE")
|
||||||
click_button submit(:user, :login)
|
click_button submit(:user, :login)
|
||||||
|
|
||||||
expect(page).to have_content(I18n.t('login_successful'))
|
expect(page).to have_content(I18n.t("login_successful"))
|
||||||
|
|
||||||
within user_status do
|
within user_status do
|
||||||
expect(page).to have_content(account_link)
|
expect(page).to have_content(account_link)
|
||||||
|
@ -39,6 +39,6 @@ feature 'Case insensitive login', js: :true do
|
||||||
end
|
end
|
||||||
|
|
||||||
def account_link
|
def account_link
|
||||||
'ACCOUNT'
|
"ACCOUNT"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@ feature "Visitor signs up", js: :true do
|
||||||
fill_form(:user, user.slice(*sign_up_attributes))
|
fill_form(:user, user.slice(*sign_up_attributes))
|
||||||
click_button submit(:user, :create)
|
click_button submit(:user, :create)
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(user_status).to have_content("ACCOUNT")
|
expect(user_status).to have_content("ACCOUNT")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
2
spec/services/api/v1/users_collection_spec.rb
Normal file → Executable file
2
spec/services/api/v1/users_collection_spec.rb
Normal file → Executable file
|
@ -28,4 +28,4 @@ describe Api::V1::UsersCollection do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
2
spec/support/features/form_helpers.rb
Normal file → Executable file
2
spec/support/features/form_helpers.rb
Normal file → Executable file
|
@ -2,7 +2,7 @@ module Features
|
||||||
module FormHelpers
|
module FormHelpers
|
||||||
def fill_form(model, hash)
|
def fill_form(model, hash)
|
||||||
hash.each do |attribute, value|
|
hash.each do |attribute, value|
|
||||||
fill_in attribute_translation(model, attribute), :with => value
|
fill_in attribute_translation(model, attribute), with: value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
54
spec/support/features/server_helpers.rb
Normal file → Executable file
54
spec/support/features/server_helpers.rb
Normal file → Executable file
|
@ -1,24 +1,24 @@
|
||||||
module Features
|
module Features
|
||||||
module ServerHelpers
|
module ServerHelpers
|
||||||
def test_server_creation_and_editing
|
def test_server_creation_and_editing
|
||||||
dns = 'ServerDns.com'
|
dns = "ServerDns.com"
|
||||||
ip = '192.168.1.1'
|
ip = "192.168.1.1"
|
||||||
port = '8000'
|
port = "8000"
|
||||||
password = 'secret'
|
password = "secret"
|
||||||
name = 'MyNsServer'
|
name = "MyNsServer"
|
||||||
description = 'My NS Server'
|
description = "My NS Server"
|
||||||
irc = '#some_channel'
|
irc = "#some_channel"
|
||||||
|
|
||||||
visit new_server_path
|
visit new_server_path
|
||||||
fill_in 'Dns', with: dns
|
fill_in "Dns", with: dns
|
||||||
fill_in 'server_ip', with: ip
|
fill_in "server_ip", with: ip
|
||||||
fill_in 'server_port', with: port
|
fill_in "server_port", with: port
|
||||||
fill_in 'Password', with: password
|
fill_in "Password", with: password
|
||||||
fill_in 'Name', with: name
|
fill_in "Name", with: name
|
||||||
fill_in 'Description', with: description
|
fill_in "Description", with: description
|
||||||
fill_in 'Irc', with: irc
|
fill_in "Irc", with: irc
|
||||||
check 'Available for officials?'
|
check "Available for officials?"
|
||||||
click_button 'Save'
|
click_button "Save"
|
||||||
|
|
||||||
expect(page).to have_content(dns)
|
expect(page).to have_content(dns)
|
||||||
expect(page).to have_content("#{ip}:#{port}")
|
expect(page).to have_content("#{ip}:#{port}")
|
||||||
|
@ -26,17 +26,17 @@ module Features
|
||||||
expect(page).to have_content(irc)
|
expect(page).to have_content(irc)
|
||||||
expect(page).to have_content(description)
|
expect(page).to have_content(description)
|
||||||
|
|
||||||
click_link 'Edit Server'
|
click_link "Edit Server"
|
||||||
|
|
||||||
fill_in 'Dns', with: "#{dns}2"
|
fill_in "Dns", with: "#{dns}2"
|
||||||
fill_in 'server_ip', with: "192.168.1.2"
|
fill_in "server_ip", with: "192.168.1.2"
|
||||||
fill_in 'server_port', with: "8001"
|
fill_in "server_port", with: "8001"
|
||||||
fill_in 'Password', with: "#{password}2"
|
fill_in "Password", with: "#{password}2"
|
||||||
fill_in 'Name', with: "#{name}2"
|
fill_in "Name", with: "#{name}2"
|
||||||
fill_in 'Description', with: "#{description}2"
|
fill_in "Description", with: "#{description}2"
|
||||||
fill_in 'Irc', with: "#{irc}2"
|
fill_in "Irc", with: "#{irc}2"
|
||||||
check 'Available for officials?'
|
check "Available for officials?"
|
||||||
click_button 'Save'
|
click_button "Save"
|
||||||
|
|
||||||
expect(page).to have_content("192.168.1.2:8001")
|
expect(page).to have_content("192.168.1.2:8001")
|
||||||
expect(page).to have_content("#{dns}2")
|
expect(page).to have_content("#{dns}2")
|
||||||
|
@ -45,4 +45,4 @@ module Features
|
||||||
expect(page).to have_content("#{description}2")
|
expect(page).to have_content("#{description}2")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
12
spec/support/features/session_helpers.rb
Normal file → Executable file
12
spec/support/features/session_helpers.rb
Normal file → Executable file
|
@ -1,21 +1,21 @@
|
||||||
module Features
|
module Features
|
||||||
module SessionHelpers
|
module SessionHelpers
|
||||||
def sign_in_as(user)
|
def sign_in_as(user)
|
||||||
visit root_path
|
visit root_path
|
||||||
|
|
||||||
fill_in "login_username", with: user.username
|
fill_in "login_username", with: user.username
|
||||||
fill_in "login_password", with: user.raw_password
|
fill_in "login_password", with: user.raw_password
|
||||||
|
|
||||||
click_button I18n.t('helpers.submit.user.login')
|
click_button I18n.t("helpers.submit.user.login")
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_timezone_for(user, timezone)
|
def change_timezone_for(user, timezone)
|
||||||
visit edit_user_path(user.id)
|
visit edit_user_path(user.id)
|
||||||
|
|
||||||
click_link I18n.t('profile.locals')
|
click_link I18n.t("profile.locals")
|
||||||
find("option[value='#{timezone}']").select_option
|
find("option[value='#{timezone}']").select_option
|
||||||
|
|
||||||
click_button I18n.t('helpers.submit.user.update')
|
click_button I18n.t("helpers.submit.user.update")
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_status
|
def user_status
|
||||||
|
@ -26,4 +26,4 @@ module Features
|
||||||
find "#new_user"
|
find "#new_user"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue