add some test and things
8
Gemfile
@@ -27,15 +27,17 @@ gem 'dotenv-rails', '~> 2.7.6'
|
||||
# Use Active Model has_secure_password
|
||||
gem 'bcrypt', '~> 3.1.7'
|
||||
# Flexible authentication solution for Rails with Warden
|
||||
gem 'devise', '~> 4.7.3'
|
||||
gem 'devise', '~> 4.8.0'
|
||||
# Tame Rails' multi-line logging into a single line per request
|
||||
gem 'lograge', '~> 0.11.2'
|
||||
# Stores and retrieves localized data through attributes on a Ruby class, with flexible support for different storage strategies
|
||||
gem 'mobility', '~> 1.1.1'
|
||||
# A generalized Rack framework for multiple-provider authentication.
|
||||
gem 'omniauth'
|
||||
# Omniauth Strategy for Battle.net OAuth Login. For more info visit https://dev.battle.net
|
||||
gem 'omniauth-bnet', '~> 2.0.0'
|
||||
gem 'omniauth-bnet', '~> 2.0.1', git: 'https://github.com/Dainii/omniauth-bnet'
|
||||
# This gem provides a mitigation against CVE-2015-9284
|
||||
gem 'omniauth-rails_csrf_protection', '~> 0.1.2'
|
||||
gem 'omniauth-rails_csrf_protection'
|
||||
# A Ruby wrapper around Blizzard's Game Data and Profile APIs
|
||||
gem 'rbattlenet', '~> 2.2.9', git: 'https://github.com/Dainii/rbattlenet'
|
||||
# A gem that provides Rails integration for the Sentry error logger
|
||||
|
||||
225
Gemfile.lock
@@ -1,3 +1,11 @@
|
||||
GIT
|
||||
remote: https://github.com/Dainii/omniauth-bnet
|
||||
revision: 4fb535d6e6a3d6e95d8d8fab55ba000b9ef02f8b
|
||||
specs:
|
||||
omniauth-bnet (2.0.1)
|
||||
omniauth (~> 2.0.4)
|
||||
omniauth-oauth2 (~> 1.7.1)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/Dainii/rbattlenet
|
||||
revision: a0492dd16f9b29b61e364009272d60e9201e1337
|
||||
@@ -9,66 +17,66 @@ GIT
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
actioncable (6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
activejob (= 6.1.3.1)
|
||||
activerecord (= 6.1.3.1)
|
||||
activestorage (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
actionmailbox (6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
activejob (= 6.1.4)
|
||||
activerecord (= 6.1.4)
|
||||
activestorage (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
actionview (= 6.1.3.1)
|
||||
activejob (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
actionmailer (6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
actionview (= 6.1.4)
|
||||
activejob (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.1.3.1)
|
||||
actionview (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
actionpack (6.1.4)
|
||||
actionview (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
rack (~> 2.0, >= 2.0.9)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
activerecord (= 6.1.3.1)
|
||||
activestorage (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
actiontext (6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
activerecord (= 6.1.4)
|
||||
activestorage (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
actionview (6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
activejob (6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
activejob (6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
activerecord (6.1.3.1)
|
||||
activemodel (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
activestorage (6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
activejob (= 6.1.3.1)
|
||||
activerecord (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
activemodel (6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
activerecord (6.1.4)
|
||||
activemodel (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
activestorage (6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
activejob (= 6.1.4)
|
||||
activerecord (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
marcel (~> 1.0.0)
|
||||
mini_mime (~> 1.0.2)
|
||||
activesupport (6.1.3.1)
|
||||
mini_mime (>= 1.1.0)
|
||||
activesupport (6.1.4)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
tzinfo (~> 2.0)
|
||||
zeitwerk (~> 2.3)
|
||||
addressable (2.7.0)
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
ast (2.4.2)
|
||||
awesome_print (1.9.2)
|
||||
@@ -76,9 +84,9 @@ GEM
|
||||
bcrypt (3.1.16)
|
||||
benchmark (0.1.1)
|
||||
bindex (0.8.1)
|
||||
bootsnap (1.7.4)
|
||||
bootsnap (1.7.7)
|
||||
msgpack (~> 1.0)
|
||||
brakeman (5.0.0)
|
||||
brakeman (5.0.4)
|
||||
builder (3.2.4)
|
||||
byebug (11.1.3)
|
||||
capybara (3.35.3)
|
||||
@@ -92,23 +100,23 @@ GEM
|
||||
childprocess (3.0.0)
|
||||
choice (0.2.0)
|
||||
coderay (1.1.3)
|
||||
concurrent-ruby (1.1.8)
|
||||
concurrent-ruby (1.1.9)
|
||||
connection_pool (2.2.5)
|
||||
crass (1.0.6)
|
||||
database_cleaner (2.0.1)
|
||||
database_cleaner-active_record (~> 2.0.0)
|
||||
database_cleaner-active_record (2.0.0)
|
||||
database_cleaner-active_record (2.0.1)
|
||||
activerecord (>= 5.a)
|
||||
database_cleaner-core (~> 2.0.0)
|
||||
database_cleaner-core (2.0.1)
|
||||
devise (4.7.3)
|
||||
devise (4.8.0)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
diff-lcs (1.4.4)
|
||||
docile (1.3.5)
|
||||
docile (1.4.0)
|
||||
dotenv (2.7.6)
|
||||
dotenv-rails (2.7.6)
|
||||
dotenv (= 2.7.6)
|
||||
@@ -117,18 +125,28 @@ GEM
|
||||
erubi (1.10.0)
|
||||
ethon (0.14.0)
|
||||
ffi (>= 1.15.0)
|
||||
faraday (1.4.1)
|
||||
faraday (1.7.0)
|
||||
faraday-em_http (~> 1.0)
|
||||
faraday-em_synchrony (~> 1.0)
|
||||
faraday-excon (~> 1.1)
|
||||
faraday-httpclient (~> 1.0.1)
|
||||
faraday-net_http (~> 1.0)
|
||||
faraday-net_http_persistent (~> 1.1)
|
||||
faraday-patron (~> 1.0)
|
||||
faraday-rack (~> 1.0)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-em_http (1.0.0)
|
||||
faraday-em_synchrony (1.0.0)
|
||||
faraday-excon (1.1.0)
|
||||
faraday-httpclient (1.0.1)
|
||||
faraday-net_http (1.0.1)
|
||||
faraday-net_http_persistent (1.1.0)
|
||||
ffi (1.15.0)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
faraday-net_http_persistent (1.2.0)
|
||||
faraday-patron (1.0.0)
|
||||
faraday-rack (1.0.0)
|
||||
ffi (1.15.3)
|
||||
globalid (0.5.2)
|
||||
activesupport (>= 5.0)
|
||||
hashie (4.1.0)
|
||||
i18n (1.8.10)
|
||||
concurrent-ruby (~> 1.0)
|
||||
@@ -138,7 +156,7 @@ GEM
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
listen (3.5.1)
|
||||
listen (3.6.0)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
lograge (0.11.2)
|
||||
@@ -146,24 +164,24 @@ GEM
|
||||
activesupport (>= 4)
|
||||
railties (>= 4)
|
||||
request_store (~> 1.0)
|
||||
loofah (2.9.1)
|
||||
loofah (2.11.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
marcel (1.0.1)
|
||||
method_source (1.0.0)
|
||||
mini_mime (1.0.3)
|
||||
mini_mime (1.1.0)
|
||||
minitest (5.14.4)
|
||||
mobility (1.1.1)
|
||||
mobility (1.1.3)
|
||||
i18n (>= 0.6.10, < 2)
|
||||
request_store (~> 1.0)
|
||||
msgpack (1.4.2)
|
||||
multi_json (1.15.0)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
nio4r (2.5.7)
|
||||
nokogiri (1.11.7-x86_64-linux)
|
||||
nio4r (2.5.8)
|
||||
nokogiri (1.12.2-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
oauth2 (1.4.7)
|
||||
faraday (>= 0.8, < 2.0)
|
||||
@@ -171,22 +189,20 @@ GEM
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.9.1)
|
||||
omniauth (2.0.4)
|
||||
hashie (>= 3.4.6)
|
||||
rack (>= 1.6.2, < 3)
|
||||
omniauth-bnet (2.0.0)
|
||||
omniauth (~> 1.0)
|
||||
omniauth-oauth2 (~> 1.1)
|
||||
rack-protection
|
||||
omniauth-oauth2 (1.7.1)
|
||||
oauth2 (~> 1.4)
|
||||
omniauth (>= 1.9, < 3)
|
||||
omniauth-rails_csrf_protection (0.1.2)
|
||||
omniauth-rails_csrf_protection (1.0.0)
|
||||
actionpack (>= 4.2)
|
||||
omniauth (>= 1.3.1)
|
||||
omniauth (~> 2.0)
|
||||
orm_adapter (0.5.0)
|
||||
pagy (4.3.0)
|
||||
parallel (1.20.1)
|
||||
parser (3.0.1.1)
|
||||
parser (3.0.2.0)
|
||||
ast (~> 2.4.1)
|
||||
pg (1.2.3)
|
||||
pry (0.14.1)
|
||||
@@ -195,30 +211,32 @@ GEM
|
||||
pry-rails (0.3.9)
|
||||
pry (>= 0.10.4)
|
||||
public_suffix (4.0.6)
|
||||
puma (5.2.2)
|
||||
puma (5.4.0)
|
||||
nio4r (~> 2.0)
|
||||
racc (1.5.2)
|
||||
rack (2.2.3)
|
||||
rack-mini-profiler (2.3.2)
|
||||
rack (>= 1.2.0)
|
||||
rack-proxy (0.6.5)
|
||||
rack-protection (2.1.0)
|
||||
rack
|
||||
rack-proxy (0.7.0)
|
||||
rack
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (6.1.3.1)
|
||||
actioncable (= 6.1.3.1)
|
||||
actionmailbox (= 6.1.3.1)
|
||||
actionmailer (= 6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
actiontext (= 6.1.3.1)
|
||||
actionview (= 6.1.3.1)
|
||||
activejob (= 6.1.3.1)
|
||||
activemodel (= 6.1.3.1)
|
||||
activerecord (= 6.1.3.1)
|
||||
activestorage (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
rails (6.1.4)
|
||||
actioncable (= 6.1.4)
|
||||
actionmailbox (= 6.1.4)
|
||||
actionmailer (= 6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
actiontext (= 6.1.4)
|
||||
actionview (= 6.1.4)
|
||||
activejob (= 6.1.4)
|
||||
activemodel (= 6.1.4)
|
||||
activerecord (= 6.1.4)
|
||||
activestorage (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 6.1.3.1)
|
||||
railties (= 6.1.4)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
@@ -233,15 +251,15 @@ GEM
|
||||
rails-i18n (6.0.0)
|
||||
i18n (>= 0.7, < 2)
|
||||
railties (>= 6.0.0, < 7)
|
||||
railties (6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
railties (6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
rake (>= 0.13)
|
||||
thor (~> 1.0)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.3)
|
||||
rb-fsevent (0.10.4)
|
||||
rake (13.0.6)
|
||||
rb-fsevent (0.11.0)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
redis (4.2.5)
|
||||
@@ -272,29 +290,29 @@ GEM
|
||||
rspec-mocks (~> 3.10)
|
||||
rspec-support (~> 3.10)
|
||||
rspec-support (3.10.2)
|
||||
rubocop (1.17.0)
|
||||
rubocop (1.18.4)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.0.0.0)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml
|
||||
rubocop-ast (>= 1.7.0, < 2.0)
|
||||
rubocop-ast (>= 1.8.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.7.0)
|
||||
rubocop-ast (1.9.0)
|
||||
parser (>= 3.0.1.1)
|
||||
rubocop-performance (1.11.0)
|
||||
rubocop-performance (1.11.4)
|
||||
rubocop (>= 1.7.0, < 2.0)
|
||||
rubocop-ast (>= 0.4.0)
|
||||
rubocop-rails (2.9.1)
|
||||
rubocop-rails (2.11.3)
|
||||
activesupport (>= 4.2.0)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 0.90.0, < 2.0)
|
||||
rubocop (>= 1.7.0, < 2.0)
|
||||
ruby-graphviz (1.2.5)
|
||||
rexml
|
||||
ruby-progressbar (1.11.0)
|
||||
ruby2_keywords (0.0.4)
|
||||
rubyzip (2.3.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
rubyzip (2.3.2)
|
||||
sass-rails (6.0.0)
|
||||
sassc-rails (~> 2.1, >= 2.1.1)
|
||||
sassc (2.4.0)
|
||||
@@ -312,11 +330,11 @@ GEM
|
||||
sentry-rails (4.4.0)
|
||||
railties (>= 5.0)
|
||||
sentry-ruby-core (~> 4.4.0.pre.beta)
|
||||
sentry-ruby (4.4.1)
|
||||
sentry-ruby (4.4.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
faraday (>= 1.0)
|
||||
sentry-ruby-core (= 4.4.1)
|
||||
sentry-ruby-core (4.4.1)
|
||||
sentry-ruby-core (= 4.4.2)
|
||||
sentry-ruby-core (4.4.2)
|
||||
concurrent-ruby
|
||||
faraday
|
||||
sidekiq (6.2.1)
|
||||
@@ -328,8 +346,8 @@ GEM
|
||||
simplecov-html (~> 0.11)
|
||||
simplecov_json_formatter (~> 0.1)
|
||||
simplecov-html (0.12.3)
|
||||
simplecov_json_formatter (0.1.2)
|
||||
solargraph (0.42.3)
|
||||
simplecov_json_formatter (0.1.3)
|
||||
solargraph (0.43.0)
|
||||
backport (~> 1.2)
|
||||
benchmark
|
||||
bundler (>= 1.17.2)
|
||||
@@ -354,7 +372,7 @@ GEM
|
||||
sprockets (>= 3.0.0)
|
||||
thor (1.1.0)
|
||||
tilt (2.0.10)
|
||||
turbo-rails (0.5.9)
|
||||
turbo-rails (0.6.0)
|
||||
rails (>= 6.0.0)
|
||||
typhoeus (1.4.0)
|
||||
ethon (>= 0.9.0)
|
||||
@@ -372,12 +390,12 @@ GEM
|
||||
nokogiri (~> 1.6)
|
||||
rubyzip (>= 1.3.0)
|
||||
selenium-webdriver (>= 3.0, < 4.0)
|
||||
webpacker (5.2.1)
|
||||
webpacker (5.4.0)
|
||||
activesupport (>= 5.2)
|
||||
rack-proxy (>= 0.6.1)
|
||||
railties (>= 5.2)
|
||||
semantic_range (>= 2.3.0)
|
||||
websocket-driver (0.7.3)
|
||||
websocket-driver (0.7.5)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
xpath (3.2.0)
|
||||
@@ -396,13 +414,14 @@ DEPENDENCIES
|
||||
byebug
|
||||
capybara (>= 3.26)
|
||||
database_cleaner
|
||||
devise (~> 4.7.3)
|
||||
devise (~> 4.8.0)
|
||||
dotenv-rails (~> 2.7.6)
|
||||
listen (~> 3.3)
|
||||
lograge (~> 0.11.2)
|
||||
mobility (~> 1.1.1)
|
||||
omniauth-bnet (~> 2.0.0)
|
||||
omniauth-rails_csrf_protection (~> 0.1.2)
|
||||
omniauth
|
||||
omniauth-bnet (~> 2.0.1)!
|
||||
omniauth-rails_csrf_protection
|
||||
pagy (~> 4.3.0)
|
||||
pg (~> 1.1)
|
||||
pry-rails (~> 0.3.9)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RpWorldsController < ApplicationController
|
||||
before_action :set_rp_world, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
|
||||
@@ -2,11 +2,24 @@
|
||||
|
||||
class WowCharactersController < ProtectedController
|
||||
def index
|
||||
@wow_characters = current_user.wow_characters.includes(:wow_realm, :wow_race, :wow_class, :wow_character_medium, :wow_guild, :wow_covenant)
|
||||
@wow_characters = current_user.wow_characters.includes(
|
||||
:wow_realm,
|
||||
:wow_race,
|
||||
:wow_class,
|
||||
:wow_character_medium,
|
||||
:wow_guild,
|
||||
:wow_covenant
|
||||
)
|
||||
end
|
||||
|
||||
def show
|
||||
@wow_character = current_user.wow_characters.includes(wow_standings: { wow_reputation: { wow_reputation_tier: :wow_reputation_tier_levels } }).find(params[:id])
|
||||
@wow_character = current_user.wow_characters.includes(
|
||||
wow_standings: {
|
||||
wow_reputation: {
|
||||
wow_reputation_tier: :wow_reputation_tier_levels
|
||||
}
|
||||
}
|
||||
).find(params[:id])
|
||||
meta_reputation_ids = @wow_character.wow_standings.map { |standing| standing.wow_reputation.meta_wow_reputation_id }.uniq
|
||||
@meta_wow_reputations = WowReputation.find(meta_reputation_ids)
|
||||
end
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RpWorldHelper
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RpWorld < ApplicationRecord
|
||||
belongs_to :user
|
||||
alias_attribute :owner, :user
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCharacterPlayRpWorld < ApplicationRecord
|
||||
belongs_to :wow_character
|
||||
belongs_to :rp_world
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCovenant < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name, :description
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCovenantProgress < ApplicationRecord
|
||||
belongs_to :wow_character
|
||||
belongs_to :wow_covenant
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCreature < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCreatureFamily < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowCreatureType < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowItem < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowItemClass < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowItemInventoryType < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowItemQuality < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowItemSubClass < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :display_name, :verbose_name
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowSpell < ApplicationRecord
|
||||
extend Mobility
|
||||
translates :name, :description
|
||||
|
||||
@@ -6,7 +6,7 @@ class WowCharacterPositionsWorker < WowSidekiqWorker
|
||||
|
||||
# Protected data
|
||||
RBattlenet.set_options(locale: 'all')
|
||||
params = {
|
||||
params = {
|
||||
character_id: wow_character_id,
|
||||
realm_id: wow_character.wow_realm.realm_id,
|
||||
token: wow_character.user.token
|
||||
|
||||
@@ -62,7 +62,7 @@ Mobility.configure do
|
||||
# Fallbacks
|
||||
#
|
||||
# Uncomment line below to enable fallbacks, using +I18n.fallbacks+.
|
||||
# fallbacks
|
||||
fallbacks
|
||||
#
|
||||
# Or uncomment this line to enable fallbacks with a global default.
|
||||
# fallbacks { :pt => :en }
|
||||
|
||||
5
coverage/.last_run.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"result": {
|
||||
"line": 2.98
|
||||
}
|
||||
}
|
||||
2447
coverage/.resultset.json
Normal file
0
coverage/.resultset.json.lock
Normal file
BIN
coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png
Normal file
|
After Width: | Height: | Size: 160 B |
|
After Width: | Height: | Size: 148 B |
BIN
coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png
Normal file
|
After Width: | Height: | Size: 201 B |
BIN
coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png
Normal file
|
After Width: | Height: | Size: 158 B |
|
After Width: | Height: | Size: 146 B |
1
coverage/assets/0.12.3/application.css
Normal file
7
coverage/assets/0.12.3/application.js
Normal file
BIN
coverage/assets/0.12.3/colorbox/border.png
Normal file
|
After Width: | Height: | Size: 163 B |
BIN
coverage/assets/0.12.3/colorbox/controls.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
coverage/assets/0.12.3/colorbox/loading.gif
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
coverage/assets/0.12.3/colorbox/loading_background.png
Normal file
|
After Width: | Height: | Size: 166 B |
BIN
coverage/assets/0.12.3/favicon_green.png
Normal file
|
After Width: | Height: | Size: 1009 B |
BIN
coverage/assets/0.12.3/favicon_red.png
Normal file
|
After Width: | Height: | Size: 1009 B |
BIN
coverage/assets/0.12.3/favicon_yellow.png
Normal file
|
After Width: | Height: | Size: 1009 B |
BIN
coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png
Normal file
|
After Width: | Height: | Size: 180 B |
BIN
coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png
Normal file
|
After Width: | Height: | Size: 178 B |
BIN
coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png
Normal file
|
After Width: | Height: | Size: 120 B |
BIN
coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png
Normal file
|
After Width: | Height: | Size: 105 B |
BIN
coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png
Normal file
|
After Width: | Height: | Size: 111 B |
BIN
coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png
Normal file
|
After Width: | Height: | Size: 110 B |
BIN
coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png
Normal file
|
After Width: | Height: | Size: 119 B |
|
After Width: | Height: | Size: 101 B |
BIN
coverage/assets/0.12.3/images/ui-icons_222222_256x240.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
coverage/assets/0.12.3/images/ui-icons_454545_256x240.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
coverage/assets/0.12.3/images/ui-icons_888888_256x240.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
coverage/assets/0.12.3/loading.gif
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
coverage/assets/0.12.3/magnify.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
26408
coverage/index.html
Normal file
83
db/seeds.rb
@@ -1,8 +1,81 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
||||
# Character.create(name: 'Luke', movie: movies.first)
|
||||
|
||||
# Faction
|
||||
neutral_faction_name = 'NEUTRAL'
|
||||
translated_neutre_faction_name_en_gb = 'Neutral'
|
||||
translated_neutre_faction_name_fr_fr = 'Neutre'
|
||||
|
||||
horde_faction_name = 'HORDE'
|
||||
translated_horde_faction_name_en_gb = 'Horde'
|
||||
translated_horde_faction_name_fr_fr = 'Horde'
|
||||
|
||||
alliance_faction_name = 'ALLIANCE'
|
||||
translated_alliance_faction_name_en_gb = 'Alliance'
|
||||
translated_alliance_faction_name_fr_fr = 'Alliance'
|
||||
|
||||
# Create some WowRace
|
||||
# Pandaren
|
||||
wow_race = WowRace.new(
|
||||
faction: neutral_faction_name,
|
||||
is_selectable: true,
|
||||
is_allied_race: false,
|
||||
race_id: 24
|
||||
)
|
||||
Mobility.with_locale('en-gb') do
|
||||
wow_race.name = 'Pandaren'
|
||||
wow_race.male_name = 'Pandaren'
|
||||
wow_race.female_name = 'Pandaren'
|
||||
wow_race.translated_faction = translated_neutre_faction_name_en_gb
|
||||
end
|
||||
Mobility.with_locale('fr-fr') do
|
||||
wow_race.name = 'Pandaren'
|
||||
wow_race.male_name = 'Pandaren'
|
||||
wow_race.female_name = 'Pandaren'
|
||||
wow_race.translated_faction = translated_neutre_faction_name_fr_fr
|
||||
end
|
||||
wow_race.save
|
||||
|
||||
# Blood Elf
|
||||
wow_race = WowRace.new(
|
||||
faction: horde_faction_name,
|
||||
is_selectable: true,
|
||||
is_allied_race: false,
|
||||
race_id: 10
|
||||
)
|
||||
Mobility.with_locale('en-gb') do
|
||||
wow_race.name = 'Blood Elf'
|
||||
wow_race.male_name = 'Blood Elf'
|
||||
wow_race.female_name = 'Blood Elf'
|
||||
wow_race.translated_faction = translated_horde_faction_name_en_gb
|
||||
end
|
||||
Mobility.with_locale('fr-fr') do
|
||||
wow_race.name = 'Elfe de sang'
|
||||
wow_race.male_name = 'Elfe de sang'
|
||||
wow_race.female_name = 'Elfe de sang'
|
||||
wow_race.translated_faction = translated_horde_faction_name_fr_fr
|
||||
end
|
||||
wow_race.save
|
||||
|
||||
# Kul Tiran
|
||||
wow_race = WowRace.new(
|
||||
faction: alliance_faction_name,
|
||||
is_selectable: true,
|
||||
is_allied_race: true,
|
||||
race_id: 32
|
||||
)
|
||||
Mobility.with_locale('en-gb') do
|
||||
wow_race.name = 'Kul Tiran'
|
||||
wow_race.male_name = 'Kul Tiran'
|
||||
wow_race.female_name = 'Kul Tiran'
|
||||
wow_race.translated_faction = translated_alliance_faction_name_en_gb
|
||||
end
|
||||
Mobility.with_locale('fr-fr') do
|
||||
wow_race.name = 'Kultirassien'
|
||||
wow_race.male_name = 'Kultirassien'
|
||||
wow_race.female_name = 'Kultirassienne'
|
||||
wow_race.translated_faction = translated_alliance_faction_name_fr_fr
|
||||
end
|
||||
wow_race.save
|
||||
|
||||
6
spec/examples.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
example_id | status | run_time |
|
||||
----------------------------------- | ------ | --------------- |
|
||||
./spec/models/wow_race_spec.rb[1:1] | passed | 0.00354 seconds |
|
||||
./spec/models/wow_race_spec.rb[1:2] | passed | 0.00238 seconds |
|
||||
./spec/models/wow_race_spec.rb[1:3] | passed | 0.00265 seconds |
|
||||
./spec/models/wow_race_spec.rb[1:4] | passed | 0.01381 seconds |
|
||||
@@ -1,5 +1,61 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe WowRace, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
before :each do
|
||||
@wow_race = WowRace.new(
|
||||
faction: 'ALLIANCE',
|
||||
is_selectable: true,
|
||||
is_allied_race: false,
|
||||
race_id: 1
|
||||
)
|
||||
Mobility.with_locale('en-gb') do
|
||||
@wow_race.name = 'Blood Elf'
|
||||
@wow_race.male_name = 'Blood Elf'
|
||||
@wow_race.female_name = 'Blood Elf'
|
||||
@wow_race.translated_faction = 'Horde'
|
||||
end
|
||||
Mobility.with_locale('fr-fr') do
|
||||
@wow_race.name = 'Elfe de sang'
|
||||
@wow_race.male_name = 'Elfe de sang'
|
||||
@wow_race.female_name = 'Elfe de sang'
|
||||
@wow_race.translated_faction = 'Horde'
|
||||
end
|
||||
end
|
||||
|
||||
it 'is valid with valid attributes' do
|
||||
expect(@wow_race).to be_valid
|
||||
end
|
||||
|
||||
it 'race_id has to be uniq' do
|
||||
# set a race_id already used
|
||||
@wow_race.race_id = 24
|
||||
|
||||
expect(@wow_race).to_not be_valid
|
||||
end
|
||||
|
||||
it 'name must be present' do
|
||||
# unset the name attribute
|
||||
@wow_race.name = nil
|
||||
|
||||
expect(@wow_race).to_not be_valid
|
||||
end
|
||||
|
||||
it 'translated attributes' do
|
||||
# Loaf Blood Elf
|
||||
blood_elf_race = WowRace.find_by(race_id: 10)
|
||||
|
||||
Mobility.with_locale('en-gb') do
|
||||
expect(blood_elf_race.name).to eq('Blood Elf')
|
||||
expect(blood_elf_race.male_name).to eq('Blood Elf')
|
||||
expect(blood_elf_race.male_name).to eq('Blood Elf')
|
||||
expect(blood_elf_race.translated_faction).to eq('Horde')
|
||||
end
|
||||
|
||||
Mobility.with_locale('fr-fr') do
|
||||
expect(blood_elf_race.name).to eq('Elfe de sang')
|
||||
expect(blood_elf_race.male_name).to eq('Elfe de sang')
|
||||
expect(blood_elf_race.male_name).to eq('Elfe de sang')
|
||||
expect(blood_elf_race.translated_faction).to eq('Horde')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
70
spec/rails_helper.rb
Normal file
@@ -0,0 +1,70 @@
|
||||
require 'simplecov'
|
||||
SimpleCov.start 'rails' do
|
||||
add_filter '/spec/'
|
||||
end
|
||||
|
||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||
require 'spec_helper'
|
||||
ENV['RAILS_ENV'] ||= 'test'
|
||||
require File.expand_path('../config/environment', __dir__)
|
||||
# Prevent database truncation if the environment is production
|
||||
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
||||
require 'rspec/rails'
|
||||
# Add additional requires below this line. Rails is not loaded until this point!
|
||||
require 'devise'
|
||||
|
||||
# Requires supporting ruby files with custom matchers and macros, etc, in
|
||||
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
||||
# run as spec files by default. This means that files in spec/support that end
|
||||
# in _spec.rb will both be required and run as specs, causing the specs to be
|
||||
# run twice. It is recommended that you do not name files matching this glob to
|
||||
# end with _spec.rb. You can configure this pattern with the --pattern
|
||||
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
||||
#
|
||||
# The following line is provided for convenience purposes. It has the downside
|
||||
# of increasing the boot-up time by auto-requiring all files in the support
|
||||
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
||||
# require only the support files necessary.
|
||||
#
|
||||
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }
|
||||
|
||||
# Checks for pending migrations and applies them before tests are run.
|
||||
# If you are not using ActiveRecord, you can remove these lines.
|
||||
begin
|
||||
ActiveRecord::Migration.maintain_test_schema!
|
||||
rescue ActiveRecord::PendingMigrationError => e
|
||||
puts e.to_s.strip
|
||||
exit 1
|
||||
end
|
||||
RSpec.configure do |config|
|
||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||
|
||||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||
# examples within a transaction, remove the following line or assign false
|
||||
# instead of true.
|
||||
config.use_transactional_fixtures = true
|
||||
|
||||
# You can uncomment this line to turn off ActiveRecord support entirely.
|
||||
# config.use_active_record = false
|
||||
|
||||
# RSpec Rails can automatically mix in different behaviours to your tests
|
||||
# based on their file location, for example enabling you to call `get` and
|
||||
# `post` in specs under `spec/controllers`.
|
||||
#
|
||||
# You can disable this behaviour by removing the line below, and instead
|
||||
# explicitly tag your specs with their type, e.g.:
|
||||
#
|
||||
# RSpec.describe UsersController, type: :controller do
|
||||
# # ...
|
||||
# end
|
||||
#
|
||||
# The different available types are documented in the features, such as in
|
||||
# https://relishapp.com/rspec/rspec-rails/docs
|
||||
config.infer_spec_type_from_file_location!
|
||||
|
||||
# Filter lines from Rails gems in backtraces.
|
||||
config.filter_rails_from_backtrace!
|
||||
# arbitrary gems may also be filtered via:
|
||||
# config.filter_gems_from_backtrace("gem name")
|
||||
end
|
||||
96
spec/spec_helper.rb
Normal file
@@ -0,0 +1,96 @@
|
||||
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
||||
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
||||
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
||||
# this file to always be loaded, without a need to explicitly require it in any
|
||||
# files.
|
||||
#
|
||||
# Given that it is always loaded, you are encouraged to keep this file as
|
||||
# light-weight as possible. Requiring heavyweight dependencies from this file
|
||||
# will add to the boot time of your test suite on EVERY test run, even for an
|
||||
# individual file that may not need all of that loaded. Instead, consider making
|
||||
# a separate helper file that requires the additional dependencies and performs
|
||||
# the additional setup, and require it from the spec files that actually need
|
||||
# it.
|
||||
#
|
||||
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
||||
RSpec.configure do |config|
|
||||
# rspec-expectations config goes here. You can use an alternate
|
||||
# assertion/expectation library such as wrong or the stdlib/minitest
|
||||
# assertions if you prefer.
|
||||
config.expect_with :rspec do |expectations|
|
||||
# This option will default to `true` in RSpec 4. It makes the `description`
|
||||
# and `failure_message` of custom matchers include text for helper methods
|
||||
# defined using `chain`, e.g.:
|
||||
# be_bigger_than(2).and_smaller_than(4).description
|
||||
# # => "be bigger than 2 and smaller than 4"
|
||||
# ...rather than:
|
||||
# # => "be bigger than 2"
|
||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
||||
end
|
||||
|
||||
# rspec-mocks config goes here. You can use an alternate test double
|
||||
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
||||
config.mock_with :rspec do |mocks|
|
||||
# Prevents you from mocking or stubbing a method that does not exist on
|
||||
# a real object. This is generally recommended, and will default to
|
||||
# `true` in RSpec 4.
|
||||
mocks.verify_partial_doubles = true
|
||||
end
|
||||
|
||||
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
||||
# have no way to turn it off -- the option exists only for backwards
|
||||
# compatibility in RSpec 3). It causes shared context metadata to be
|
||||
# inherited by the metadata hash of host groups and examples, rather than
|
||||
# triggering implicit auto-inclusion in groups with matching metadata.
|
||||
config.shared_context_metadata_behavior = :apply_to_host_groups
|
||||
|
||||
# The settings below are suggested to provide a good initial experience
|
||||
# with RSpec, but feel free to customize to your heart's content.
|
||||
begin
|
||||
# This allows you to limit a spec run to individual examples or groups
|
||||
# you care about by tagging them with `:focus` metadata. When nothing
|
||||
# is tagged with `:focus`, all examples get run. RSpec also provides
|
||||
# aliases for `it`, `describe`, and `context` that include `:focus`
|
||||
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
||||
config.filter_run_when_matching :focus
|
||||
|
||||
# Allows RSpec to persist some state between runs in order to support
|
||||
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
||||
# you configure your source control system to ignore this file.
|
||||
config.example_status_persistence_file_path = "spec/examples.txt"
|
||||
|
||||
# Limits the available syntax to the non-monkey patched syntax that is
|
||||
# recommended. For more details, see:
|
||||
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
||||
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
||||
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
||||
config.disable_monkey_patching!
|
||||
|
||||
# Many RSpec users commonly either run the entire suite or an individual
|
||||
# file, and it's useful to allow more verbose output when running an
|
||||
# individual spec file.
|
||||
if config.files_to_run.one?
|
||||
# Use the documentation formatter for detailed output,
|
||||
# unless a formatter has already been configured
|
||||
# (e.g. via a command-line flag).
|
||||
config.default_formatter = "doc"
|
||||
end
|
||||
|
||||
# Print the 10 slowest examples and example groups at the
|
||||
# end of the spec run, to help surface which specs are running
|
||||
# particularly slow.
|
||||
config.profile_examples = 10
|
||||
|
||||
# Run specs in random order to surface order dependencies. If you find an
|
||||
# order dependency and want to debug it, you can fix the order by providing
|
||||
# the seed, which is printed after each run.
|
||||
# --seed 1234
|
||||
config.order = :random
|
||||
|
||||
# Seed global randomization in this process using the `--seed` CLI option.
|
||||
# Setting this allows you to use `--seed` to deterministically reproduce
|
||||
# test failures related to randomization by passing the same `--seed` value
|
||||
# as the one that triggered the failure.
|
||||
Kernel.srand config.seed
|
||||
end
|
||||
end
|
||||
8
spec/support/database_cleaner.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
RSpec.configure do |config|
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.strategy = :truncation
|
||||
DatabaseCleaner.clean_with(:truncation)
|
||||
|
||||
Rails.application.load_seed
|
||||
end
|
||||
end
|
||||