Fixed issue #2089 - timezone issue with report graphs not displaying or displaying $timezone hours out of step.

This commit is contained in:
Martin Edenhofer 2019-03-27 10:01:36 +01:00 committed by Thorsten Eckel
parent 8f30c37ddf
commit 3acfa4a277
27 changed files with 239 additions and 278 deletions

10
Gemfile
View file

@ -17,8 +17,8 @@ gem 'unicorn', group: :unicorn
# core - supported ORMs # core - supported ORMs
gem 'activerecord-nulldb-adapter', group: :nulldb gem 'activerecord-nulldb-adapter', group: :nulldb
gem 'mysql2', group: :mysql gem 'mysql2', '0.4.10', group: :mysql
gem 'pg', group: :postgres gem 'pg', '0.21.0', group: :postgres
# core - asynchrous task execution # core - asynchrous task execution
gem 'daemons' gem 'daemons'
@ -29,7 +29,7 @@ gem 'em-websocket'
gem 'eventmachine' gem 'eventmachine'
# core - password security # core - password security
gem 'argon2' gem 'argon2', '1.1.5'
# performance - Memcached # performance - Memcached
gem 'dalli' gem 'dalli'
@ -53,7 +53,7 @@ gem 'autoprefixer-rails'
# asset handling - javascript execution for e.g. linux # asset handling - javascript execution for e.g. linux
gem 'execjs' gem 'execjs'
gem 'libv8' gem 'libv8'
gem 'therubyracer' gem 'mini_racer'
# authentication - provider # authentication - provider
gem 'doorkeeper' gem 'doorkeeper'
@ -117,7 +117,7 @@ gem 'rubyntlm', git: 'https://github.com/wimm/rubyntlm'
gem 'viewpoint' gem 'viewpoint'
# image processing # image processing
gem 'rszr' gem 'rszr', '0.4.0'
# Gems used only for develop/test and not required # Gems used only for develop/test and not required
# in production environments by default. # in production environments by default.

View file

@ -79,16 +79,16 @@ GEM
activemodel (= 5.1.6.2) activemodel (= 5.1.6.2)
activesupport (= 5.1.6.2) activesupport (= 5.1.6.2)
arel (~> 8.0) arel (~> 8.0)
activerecord-import (0.25.0) activerecord-import (1.0.1)
activerecord (>= 3.2) activerecord (>= 3.2)
activerecord-nulldb-adapter (0.3.7) activerecord-nulldb-adapter (0.3.9)
activerecord (>= 2.0.0) activerecord (>= 2.0.0)
activerecord-session_store (1.1.0) activerecord-session_store (1.1.3)
actionpack (>= 4.0, < 5.2) actionpack (>= 4.0)
activerecord (>= 4.0, < 5.2) activerecord (>= 4.0)
multi_json (~> 1.11, >= 1.11.2) multi_json (~> 1.11, >= 1.11.2)
rack (>= 1.5.2, < 3) rack (>= 1.5.2, < 3)
railties (>= 4.0, < 5.2) railties (>= 4.0)
activesupport (5.1.6.2) activesupport (5.1.6.2)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
@ -97,21 +97,21 @@ GEM
addressable (2.5.2) addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0) public_suffix (>= 2.0.2, < 4.0)
arel (8.0.0) arel (8.0.0)
argon2 (1.1.4) argon2 (1.1.5)
ffi (~> 1.9) ffi (~> 1.9)
ffi-compiler (~> 0.1) ffi-compiler (~> 0.1)
ast (2.4.0) ast (2.4.0)
autoprefixer-rails (7.1.6) autoprefixer-rails (9.5.0)
execjs execjs
binding_of_caller (0.8.0) binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
biz (1.8.2) biz (1.8.2)
clavius (~> 1.0) clavius (~> 1.0)
tzinfo tzinfo
browser (2.5.2) browser (2.5.3)
buftok (0.2.0) buftok (0.2.0)
builder (3.2.3) builder (3.2.3)
byebug (10.0.2) byebug (11.0.1)
capybara (2.18.0) capybara (2.18.0)
addressable addressable
mini_mime (>= 0.1.3) mini_mime (>= 0.1.3)
@ -139,17 +139,17 @@ GEM
composite_primary_keys (10.0.5) composite_primary_keys (10.0.5)
activerecord (~> 5.1.0, >= 5.1.6) activerecord (~> 5.1.0, >= 5.1.6)
concurrent-ruby (1.1.5) concurrent-ruby (1.1.5)
coveralls (0.7.1) coveralls (0.8.22)
multi_json (~> 1.3) json (>= 1.8, < 3)
rest-client simplecov (~> 0.16.1)
simplecov (>= 0.7) term-ansicolor (~> 1.3)
term-ansicolor thor (~> 0.19.4)
thor tins (~> 1.6)
crack (0.4.3) crack (0.4.3)
safe_yaml (~> 1.0.0) safe_yaml (~> 1.0.0)
crass (1.0.4) crass (1.0.4)
daemons (1.2.5) daemons (1.3.1)
dalli (2.7.6) dalli (2.7.10)
debug_inspector (0.0.3) debug_inspector (0.0.3)
delayed_job (4.1.5) delayed_job (4.1.5)
activesupport (>= 3.0, < 5.3) activesupport (>= 3.0, < 5.3)
@ -157,11 +157,11 @@ GEM
activerecord (>= 3.0, < 5.3) activerecord (>= 3.0, < 5.3)
delayed_job (>= 3.0, < 5) delayed_job (>= 3.0, < 5)
diff-lcs (1.3) diff-lcs (1.3)
diffy (3.2.0) diffy (3.3.0)
docile (1.1.5) docile (1.3.1)
domain_name (0.5.20180417) domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
doorkeeper (4.4.0) doorkeeper (5.0.2)
railties (>= 4.2) railties (>= 4.2)
eco (1.0.0) eco (1.0.0)
coffee-script coffee-script
@ -173,20 +173,20 @@ GEM
http_parser.rb (~> 0.6.0) http_parser.rb (~> 0.6.0)
equalizer (0.0.11) equalizer (0.0.11)
erubi (1.8.0) erubi (1.8.0)
eventmachine (1.2.5) eventmachine (1.2.7)
execjs (2.7.0) execjs (2.7.0)
factory_bot (4.8.2) factory_bot (5.0.2)
activesupport (>= 3.0.0) activesupport (>= 4.2.0)
factory_bot_rails (4.8.2) factory_bot_rails (5.0.1)
factory_bot (~> 4.8.2) factory_bot (~> 5.0.0)
railties (>= 3.0.0) railties (>= 4.2.0)
faker (1.9.1) faker (1.9.3)
i18n (>= 0.7) i18n (>= 0.7)
faraday (0.15.4) faraday (0.15.4)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
faraday-http-cache (2.0.0) faraday-http-cache (2.0.0)
faraday (~> 0.8) faraday (~> 0.8)
ffi (1.9.25) ffi (1.10.0)
ffi-compiler (0.1.3) ffi-compiler (0.1.3)
ffi (>= 1.0.0) ffi (>= 1.0.0)
rake rake
@ -201,10 +201,10 @@ GEM
retriable (~> 2.1) retriable (~> 2.1)
globalid (0.4.2) globalid (0.4.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
guard (2.14.1) guard (2.15.0)
formatador (>= 0.2.4) formatador (>= 0.2.4)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
lumberjack (~> 1.0) lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1) nenv (~> 0.1)
notiffany (~> 0.0) notiffany (~> 0.0)
pry (>= 0.9.12) pry (>= 0.9.12)
@ -219,7 +219,7 @@ GEM
guard-symlink (0.1.1) guard-symlink (0.1.1)
guard guard
guard-compat (~> 1.1) guard-compat (~> 1.1)
hashdiff (0.3.7) hashdiff (0.3.8)
hashie (3.6.0) hashie (3.6.0)
htmlentities (4.3.4) htmlentities (4.3.4)
http (3.3.0) http (3.3.0)
@ -234,22 +234,23 @@ GEM
httpclient (2.8.3) httpclient (2.8.3)
i18n (1.6.0) i18n (1.6.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
icalendar (2.4.1) icalendar (2.5.3)
ice_cube (~> 0.16)
icalendar-recurrence (1.1.2) icalendar-recurrence (1.1.2)
icalendar (~> 2.0) icalendar (~> 2.0)
ice_cube (~> 0.13) ice_cube (~> 0.13)
ice_cube (0.16.2) ice_cube (0.16.3)
inflection (1.0.0) inflection (1.0.0)
interception (0.5) interception (0.5)
jaro_winkler (1.5.2) jaro_winkler (1.5.2)
json (2.1.0) json (2.2.0)
jwt (2.1.0) jwt (2.1.0)
kgio (2.11.2) kgio (2.11.2)
koala (3.0.0) koala (3.0.0)
addressable addressable
faraday faraday
json (>= 1.8) json (>= 1.8)
libv8 (3.16.14.19) libv8 (6.7.288.46.1)
listen (3.1.5) listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
@ -261,7 +262,7 @@ GEM
loofah (2.2.3) loofah (2.2.3)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
lumberjack (1.0.12) lumberjack (1.0.13)
memoizable (0.4.2) memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1) thread_safe (~> 0.3, >= 0.3.1)
method_source (0.9.2) method_source (0.9.2)
@ -270,6 +271,8 @@ GEM
mime-types-data (3.2018.0812) mime-types-data (3.2018.0812)
mini_mime (1.0.1) mini_mime (1.0.1)
mini_portile2 (2.4.0) mini_portile2 (2.4.0)
mini_racer (0.2.4)
libv8 (>= 6.3)
minitest (5.11.3) minitest (5.11.3)
multi_json (1.13.1) multi_json (1.13.1)
multi_xml (0.6.0) multi_xml (0.6.0)
@ -287,32 +290,31 @@ GEM
notiffany (0.1.1) notiffany (0.1.1)
nenv (~> 0.1) nenv (~> 0.1)
shellany (~> 0.0) shellany (~> 0.0)
oauth (0.5.3) oauth (0.5.4)
oauth2 (1.4.1) oauth2 (1.4.1)
faraday (>= 0.8, < 0.16.0) faraday (>= 0.8, < 0.16.0)
jwt (>= 1.0, < 3.0) jwt (>= 1.0, < 3.0)
multi_json (~> 1.3) multi_json (~> 1.3)
multi_xml (~> 0.5) multi_xml (~> 0.5)
rack (>= 1.2, < 3) rack (>= 1.2, < 3)
octokit (4.7.0) octokit (4.13.0)
sawyer (~> 0.8.0, >= 0.5.3) sawyer (~> 0.8.0, >= 0.5.3)
omniauth (1.9.0) omniauth (1.9.0)
hashie (>= 3.4.6, < 3.7.0) hashie (>= 3.4.6, < 3.7.0)
rack (>= 1.6.2, < 3) rack (>= 1.6.2, < 3)
omniauth-facebook (4.0.0) omniauth-facebook (5.0.0)
omniauth-oauth2 (~> 1.2) omniauth-oauth2 (~> 1.2)
omniauth-github (1.3.0) omniauth-github (1.3.0)
omniauth (~> 1.5) omniauth (~> 1.5)
omniauth-oauth2 (>= 1.4.0, < 2.0) omniauth-oauth2 (>= 1.4.0, < 2.0)
omniauth-gitlab (1.0.2) omniauth-gitlab (2.0.0)
omniauth (~> 1.0) omniauth (~> 1.0)
omniauth-oauth2 (~> 1.0) omniauth-oauth2 (~> 1.0)
omniauth-google-oauth2 (0.6.0) omniauth-google-oauth2 (0.6.1)
jwt (>= 2.0) jwt (>= 2.0)
omniauth (>= 1.1.1) omniauth (>= 1.1.1)
omniauth-oauth2 (>= 1.5) omniauth-oauth2 (>= 1.5)
omniauth-linkedin-oauth2 (0.2.5) omniauth-linkedin-oauth2 (1.0.0)
omniauth (~> 1.0)
omniauth-oauth2 omniauth-oauth2
omniauth-microsoft-office365 (0.0.7) omniauth-microsoft-office365 (0.0.7)
omniauth omniauth
@ -326,36 +328,36 @@ GEM
omniauth-twitter (1.4.0) omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1) omniauth-oauth (~> 1.1)
rack rack
omniauth-weibo-oauth2 (0.4.5) omniauth-weibo-oauth2 (0.5.2)
omniauth (~> 1.5) omniauth (~> 1.5)
omniauth-oauth2 (>= 1.4.0) omniauth-oauth2 (>= 1.4.0)
parallel (1.14.0) parallel (1.15.0)
parser (2.6.0.0) parser (2.6.2.0)
ast (~> 2.4.0) ast (~> 2.4.0)
pg (0.21.0) pg (0.21.0)
pluginator (1.5.0) pluginator (1.5.0)
power_assert (1.1.1) power_assert (1.1.4)
pre-commit (0.37.0) pre-commit (0.39.0)
pluginator (~> 1.5) pluginator (~> 1.5)
pry (0.11.3) pry (0.12.2)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.9.0) method_source (~> 0.9.0)
pry-rails (0.3.6) pry-rails (0.3.9)
pry (>= 0.10.4) pry (>= 0.10.4)
pry-remote (0.1.8) pry-remote (0.1.8)
pry (~> 0.9) pry (~> 0.9)
slop (~> 3.0) slop (~> 3.0)
pry-rescue (1.4.5) pry-rescue (1.5.0)
interception (>= 0.5) interception (>= 0.5)
pry pry (>= 0.12.0)
pry-stack_explorer (0.4.9.2) pry-stack_explorer (0.4.9.3)
binding_of_caller (>= 0.7) binding_of_caller (>= 0.7)
pry (>= 0.9.11) pry (>= 0.9.11)
psych (3.1.0) psych (3.1.0)
public_suffix (3.0.1) public_suffix (3.0.3)
puma (3.12.0) puma (3.12.1)
rack (2.0.6) rack (2.0.6)
rack-livereload (0.3.16) rack-livereload (0.3.17)
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
@ -387,11 +389,10 @@ GEM
rainbow (3.0.0) rainbow (3.0.0)
raindrops (0.19.0) raindrops (0.19.0)
rake (12.3.2) rake (12.3.2)
rb-fsevent (0.10.2) rb-fsevent (0.10.3)
rb-inotify (0.9.10) rb-inotify (0.10.0)
ffi (>= 0.5.0, < 2) ffi (~> 1.0)
rchardet (1.8.0) rchardet (1.8.0)
ref (2.0.0)
rest-client (2.0.2) rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0) mime-types (>= 1.16, < 4.0)
@ -399,13 +400,13 @@ GEM
retriable (2.1.0) retriable (2.1.0)
rspec-core (3.8.0) rspec-core (3.8.0)
rspec-support (~> 3.8.0) rspec-support (~> 3.8.0)
rspec-expectations (3.8.1) rspec-expectations (3.8.2)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0) rspec-support (~> 3.8.0)
rspec-mocks (3.8.0) rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0) rspec-support (~> 3.8.0)
rspec-rails (3.8.0) rspec-rails (3.8.2)
actionpack (>= 3.0) actionpack (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
railties (>= 3.0) railties (>= 3.0)
@ -414,7 +415,7 @@ GEM
rspec-mocks (~> 3.8.0) rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0) rspec-support (~> 3.8.0)
rspec-support (3.8.0) rspec-support (3.8.0)
rszr (0.3.2) rszr (0.4.0)
rubocop (0.66.0) rubocop (0.66.0)
jaro_winkler (~> 1.5.1) jaro_winkler (~> 1.5.1)
parallel (~> 1.10) parallel (~> 1.10)
@ -426,11 +427,11 @@ GEM
ruby-progressbar (1.10.0) ruby-progressbar (1.10.0)
ruby_dep (1.5.0) ruby_dep (1.5.0)
rubyzip (1.2.2) rubyzip (1.2.2)
safe_yaml (1.0.4) safe_yaml (1.0.5)
sassc (2.0.0) sassc (2.0.1)
ffi (~> 1.9.6) ffi (~> 1.9)
rake rake
sassc-rails (2.0.0) sassc-rails (2.1.0)
railties (>= 4.0.0) railties (>= 4.0.0)
sassc (>= 2.0) sassc (>= 2.0)
sprockets (> 3.0) sprockets (> 3.0)
@ -439,19 +440,19 @@ GEM
sawyer (0.8.1) sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6) addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0) faraday (~> 0.8, < 1.0)
selenium-webdriver (3.13.1) selenium-webdriver (3.141.0)
childprocess (~> 0.5) childprocess (~> 0.5)
rubyzip (~> 1.2) rubyzip (~> 1.2, >= 1.2.2)
shellany (0.0.1) shellany (0.0.1)
simple_oauth (0.3.1) simple_oauth (0.3.1)
simplecov (0.15.1) simplecov (0.16.1)
docile (~> 1.1.0) docile (~> 1.1)
json (>= 1.8, < 3) json (>= 1.8, < 3)
simplecov-html (~> 0.10.0) simplecov-html (~> 0.10.0)
simplecov-html (0.10.2) simplecov-html (0.10.2)
simplecov-rcov (0.2.3) simplecov-rcov (0.2.3)
simplecov (>= 0.4.1) simplecov (>= 0.4.1)
slack-notifier (2.3.1) slack-notifier (2.3.2)
slop (3.6.0) slop (3.6.0)
spring (2.0.2) spring (2.0.2)
activesupport (>= 4.2) activesupport (>= 4.2)
@ -466,37 +467,34 @@ GEM
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (1.3.13) sqlite3 (1.4.0)
telegramAPI (1.4.2) telegramAPI (1.4.2)
rest-client (~> 2.0, >= 2.0.2) rest-client (~> 2.0, >= 2.0.2)
telephone_number (1.3.0) telephone_number (1.3.4)
term-ansicolor (1.6.0) term-ansicolor (1.7.1)
tins (~> 1.0) tins (~> 1.0)
test-unit (3.2.6) test-unit (3.3.0)
power_assert power_assert
therubyracer (0.12.3) thor (0.19.4)
libv8 (~> 3.16.14.15)
ref
thor (0.20.3)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.8) tilt (2.0.9)
tins (1.15.1) tins (1.20.2)
twilio-ruby (5.10.2) twilio-ruby (5.21.2)
faraday (~> 0.9) faraday (~> 0.9)
jwt (>= 1.5, <= 2.5) jwt (>= 1.5, <= 2.5)
nokogiri (>= 1.6, < 2.0) nokogiri (>= 1.6, < 2.0)
tzinfo (1.2.5) tzinfo (1.2.5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (3.2.0) uglifier (4.1.20)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.5) unf_ext (0.0.7.5)
unicode-display_width (1.5.0) unicode-display_width (1.5.0)
unicorn (5.4.1) unicorn (5.5.0)
kgio (~> 2.6) kgio (~> 2.6)
raindrops (~> 0.7) raindrops (~> 0.7)
valid_email2 (2.1.0) valid_email2 (3.0.1)
activemodel (>= 3.2) activemodel (>= 3.2)
mail (~> 2.5) mail (~> 2.5)
vcr (4.0.0) vcr (4.0.0)
@ -505,7 +503,7 @@ GEM
logging logging
nokogiri nokogiri
rubyntlm rubyntlm
webmock (3.1.1) webmock (3.5.1)
addressable (>= 2.3.6) addressable (>= 2.3.6)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff hashdiff
@ -515,7 +513,7 @@ GEM
writeexcel (1.0.5) writeexcel (1.0.5)
xpath (3.2.0) xpath (3.2.0)
nokogiri (~> 1.8) nokogiri (~> 1.8)
zendesk_api (1.16.0) zendesk_api (1.17.0)
faraday (~> 0.9) faraday (~> 0.9)
hashie (>= 3.5.2, < 4.0.0) hashie (>= 3.5.2, < 4.0.0)
inflection inflection
@ -529,7 +527,7 @@ DEPENDENCIES
activerecord-import activerecord-import
activerecord-nulldb-adapter activerecord-nulldb-adapter
activerecord-session_store activerecord-session_store
argon2 argon2 (= 1.1.5)
autodiscover! autodiscover!
autoprefixer-rails autoprefixer-rails
biz biz
@ -565,7 +563,8 @@ DEPENDENCIES
libv8 libv8
mail! mail!
mime-types mime-types
mysql2 mini_racer
mysql2 (= 0.4.10)
net-ldap net-ldap
oauth2 oauth2
omniauth omniauth
@ -578,7 +577,7 @@ DEPENDENCIES
omniauth-oauth2 omniauth-oauth2
omniauth-twitter omniauth-twitter
omniauth-weibo-oauth2 omniauth-weibo-oauth2
pg pg (= 0.21.0)
pre-commit pre-commit
pry-rails pry-rails
pry-remote pry-remote
@ -591,7 +590,7 @@ DEPENDENCIES
rb-fsevent rb-fsevent
rchardet (>= 1.8.0) rchardet (>= 1.8.0)
rspec-rails rspec-rails
rszr rszr (= 0.4.0)
rubocop rubocop
rubyntlm! rubyntlm!
sassc-rails sassc-rails
@ -608,7 +607,6 @@ DEPENDENCIES
telegramAPI telegramAPI
telephone_number telephone_number
test-unit test-unit
therubyracer
twilio-ruby twilio-ruby
twitter! twitter!
uglifier uglifier

View file

@ -1,15 +1,15 @@
FactoryBot.define do FactoryBot.define do
factory :avatar do factory :avatar do
object_lookup_id { ObjectLookup.by_name('User') } object_lookup_id { ObjectLookup.by_name('User') }
o_id 1 o_id { 1 }
default true default { true }
deletable true deletable { true }
initial false initial { false }
source 'init' source { 'init' }
source_url nil source_url { nil }
created_by_id 1 created_by_id { 1 }
updated_by_id 1 updated_by_id { 1 }
created_at Time.zone.now created_at { Time.zone.now }
updated_at Time.zone.now updated_at { Time.zone.now }
end end
end end

View file

@ -1,10 +1,10 @@
FactoryBot.define do FactoryBot.define do
factory :calendar do factory :calendar do
sequence(:name) { |n| "Escalation Test #{n}" } sequence(:name) { |n| "Escalation Test #{n}" }
timezone 'Europe/Berlin' timezone { 'Europe/Berlin' }
default true default { true }
ical_url nil ical_url { nil }
business_hours do business_hours do
{ {
mon: { mon: {
active: true, active: true,
@ -36,7 +36,7 @@ FactoryBot.define do
} }
} }
end end
created_by_id 1 created_by_id { 1 }
updated_by_id 1 updated_by_id { 1 }
end end
end end

View file

@ -1,15 +1,15 @@
FactoryBot.define do FactoryBot.define do
factory :channel do factory :channel do
area 'Email::Dummy' area { 'Email::Dummy' }
group { ::Group.find(1) } group { ::Group.find(1) }
active true active { true }
options {} options {}
preferences {} preferences {}
updated_by_id 1 updated_by_id { 1 }
created_by_id 1 created_by_id { 1 }
factory :email_channel do factory :email_channel do
area 'Email::Account' area { 'Email::Account' }
options do options do
{ {
inbound: { inbound: {
@ -27,7 +27,7 @@ FactoryBot.define do
custom_options { {} } custom_options { {} }
end end
area 'Twitter::Account' area { 'Twitter::Account' }
options do options do
{ {
adapter: 'twitter', adapter: 'twitter',

View file

@ -1,12 +1,12 @@
FactoryBot.define do FactoryBot.define do
factory :external_credential do factory :external_credential do
factory :facebook_credential do factory :facebook_credential do
name 'facebook' name { 'facebook' }
credentials { { application_id: 123, application_secret: 123 } } credentials { { application_id: 123, application_secret: 123 } }
end end
factory :twitter_credential do factory :twitter_credential do
name 'twitter' name { 'twitter' }
credentials do credentials do
{ consumer_key: 123, { consumer_key: 123,

View file

@ -1,8 +1,8 @@
FactoryBot.define do FactoryBot.define do
factory :group do factory :group do
sequence(:name) { |n| "Group #{n}" }
email_address email_address
created_by_id { 1 } sequence(:name) { |n| "Group #{n}" }
updated_by_id { 1 } created_by_id { 1 }
updated_by_id { 1 }
end end
end end

View file

@ -1,12 +1,12 @@
FactoryBot.define do FactoryBot.define do
factory :http_log do factory :http_log do
direction 'in' direction { 'in' }
facility 'cti' facility { 'cti' }
add_attribute(:method) { 'post' } add_attribute(:method) { 'post' }
url 'https://zammad.fqdn.com/api/v1/integration/cti/log' url { 'https://zammad.fqdn.com/api/v1/integration/cti/log' }
request { { content: 'foo' } } request { { content: 'foo' } }
response { { content: 'bar' } } response { { content: 'bar' } }
created_by_id 1 created_by_id { 1 }
updated_by_id 1 updated_by_id { 1 }
end end
end end

View file

@ -1,7 +1,7 @@
FactoryBot.define do FactoryBot.define do
factory :import_job do factory :import_job do
name 'Import::Test' name { 'Import::Test' }
payload {} payload {}
dry_run false dry_run { false }
end end
end end

View file

@ -1,13 +1,19 @@
FactoryBot.define do FactoryBot.define do
factory :job do factory :job do
sequence(:name) { |n| "Test job #{n}" } sequence(:name) { |n| "Test job #{n}" }
condition { { 'ticket.state_id' => { 'operator' => 'is not', 'value' => 4 } } } condition { { 'ticket.state_id' => { 'operator' => 'is not', 'value' => 4 } } }
perform { { 'ticket.state_id' => { 'value' => 4 } } } perform { { 'ticket.state_id' => { 'value' => 4 } } }
active true active { true }
created_by_id 1 created_by_id { 1 }
updated_by_id 1 updated_by_id { 1 }
timeplan do timeplan do
{ 'days' => { 'Mon' => true, 'Tue' => false, 'Wed' => false, 'Thu' => false, 'Fri' => false, 'Sat' => false, 'Sun' => false }, { 'days' => { 'Mon' => true,
'Tue' => false,
'Wed' => false,
'Thu' => false,
'Fri' => false,
'Sat' => false,
'Sun' => false },
'hours' => 'hours' =>
{ '0' => true, { '0' => true,
'1' => false, '1' => false,
@ -33,7 +39,12 @@ FactoryBot.define do
'21' => false, '21' => false,
'22' => false, '22' => false,
'23' => false }, '23' => false },
'minutes' => { '0' => true, '10' => false, '20' => false, '30' => false, '40' => false, '50' => false } } 'minutes' => { '0' => true,
'10' => false,
'20' => false,
'30' => false,
'40' => false,
'50' => false } }
end end
end end
end end

View file

@ -1,6 +1,6 @@
FactoryBot.define do FactoryBot.define do
factory :locale do factory :locale do
locale 'de-de' locale { 'de-de' }
name 'Deutsch' name { 'Deutsch' }
end end
end end

View file

@ -1,9 +1,7 @@
FactoryBot.define do FactoryBot.define do
factory :macro do factory :macro do
sequence(:name) { |n| "Macro #{n}" } sequence(:name) { |n| "Macro #{n}" }
perform do perform { {} }
{}
end
ux_flow_next_up { 'next_task' } ux_flow_next_up { 'next_task' }
note { '' } note { '' }
active { true } active { true }

View file

@ -1,9 +1,9 @@
FactoryBot.define do FactoryBot.define do
factory :notification_factory_renderer, class: NotificationFactory::Renderer do factory :notification_factory_renderer, class: NotificationFactory::Renderer do
objects {} objects {}
locale 'en-en' locale { 'en-en' }
template '' template { '' }
escape true escape { true }
initialize_with { new(objects: objects, locale: locale, template: template, escape: escape) } initialize_with { new(objects: objects, locale: locale, template: template, escape: escape) }
end end

View file

@ -1,25 +1,19 @@
FactoryBot.define do
sequence :object_manager_attribute_name do |n|
"internal_name#{n}"
end
sequence :object_manager_attribute_display do |n|
"Display Name #{n}"
end
end
FactoryBot.define do FactoryBot.define do
factory :object_manager_attribute, class: ObjectManager::Attribute do factory :object_manager_attribute, class: ObjectManager::Attribute do
object_lookup_id { ObjectLookup.by_name('Ticket') }
object_lookup_id { ObjectLookup.by_name('Ticket') } sequence(:name) { |n| "internal_name#{n}" }
name { generate(:object_manager_attribute_name) } sequence(:display) { |n| "Display Name #{n}" }
display { generate(:object_manager_attribute_display) } data_option_new { {} }
data_option_new do editable { true }
{} active { true }
end add_attribute(:to_create) { true }
editable true to_migrate { true }
active true to_delete { false }
screens do to_config { false }
position { 15 }
updated_by_id { 1 }
created_by_id { 1 }
screens do
{ {
'create_top' => { 'create_top' => {
'-all-' => { '-all-' => {
@ -29,17 +23,10 @@ FactoryBot.define do
'edit' => {} 'edit' => {}
} }
end end
add_attribute(:to_create) { true }
to_migrate true
to_delete false
to_config false
position 15
updated_by_id 1
created_by_id 1
end end
factory :object_manager_attribute_text, parent: :object_manager_attribute do factory :object_manager_attribute_text, parent: :object_manager_attribute do
data_type 'input' data_type { 'input' }
data_option do data_option do
{ {
'type' => 'text', 'type' => 'text',
@ -54,7 +41,7 @@ FactoryBot.define do
end end
factory :object_manager_attribute_integer, parent: :object_manager_attribute do factory :object_manager_attribute_integer, parent: :object_manager_attribute do
data_type 'integer' data_type { 'integer' }
data_option do data_option do
{ {
'default' => 0, 'default' => 0,
@ -65,8 +52,8 @@ FactoryBot.define do
end end
factory :object_manager_attribute_date, parent: :object_manager_attribute do factory :object_manager_attribute_date, parent: :object_manager_attribute do
name 'date_attribute' name { 'date_attribute' }
data_type 'date' data_type { 'date' }
data_option do data_option do
{ {
'diff' => 24, 'diff' => 24,
@ -76,8 +63,8 @@ FactoryBot.define do
end end
factory :object_manager_attribute_datetime, parent: :object_manager_attribute do factory :object_manager_attribute_datetime, parent: :object_manager_attribute do
name 'datetime_attribute' name { 'datetime_attribute' }
data_type 'datetime' data_type { 'datetime' }
data_option do data_option do
{ {
'future' => true, 'future' => true,
@ -89,7 +76,7 @@ FactoryBot.define do
end end
factory :object_manager_attribute_select, parent: :object_manager_attribute do factory :object_manager_attribute_select, parent: :object_manager_attribute do
data_type 'select' data_type { 'select' }
data_option do data_option do
{ {
'default' => '', 'default' => '',
@ -109,7 +96,7 @@ FactoryBot.define do
end end
factory :object_manager_attribute_tree_select, parent: :object_manager_attribute do factory :object_manager_attribute_tree_select, parent: :object_manager_attribute do
data_type 'tree_select' data_type { 'tree_select' }
data_option do data_option do
{ {
'options' => [ 'options' => [
@ -244,7 +231,7 @@ FactoryBot.define do
} }
end end
edit do edit do
{ {
'ticket.customer' => { 'ticket.customer' => {
shown: true, shown: true,

View file

@ -1,11 +1,11 @@
FactoryBot.define do FactoryBot.define do
factory :postmaster_filter do factory :postmaster_filter do
sequence(:name) { |n| "Test PostmasterFilter #{n}" } sequence(:name) { |n| "Test PostmasterFilter #{n}" }
channel 'email' channel { 'email' }
match { { 'from' => { 'operator' => 'contains', 'value' => 'a' } } } match { { 'from' => { 'operator' => 'contains', 'value' => 'a' } } }
perform { { 'x-zammad-ticket-tags' => { 'operator' => 'remove', 'value' => 'test2, test7' } } } perform { { 'x-zammad-ticket-tags' => { 'operator' => 'remove', 'value' => 'test2, test7' } } }
active true active { true }
created_by_id 1 created_by_id { 1 }
updated_by_id 1 updated_by_id { 1 }
end end
end end

View file

@ -1,14 +1,8 @@
FactoryBot.define do
sequence :test_role_name do |n|
"TestRole#{n}"
end
end
FactoryBot.define do FactoryBot.define do
factory :role do factory :role do
name { generate(:test_role_name) } sequence(:name) { |n| "TestRole#{n}" }
created_by_id 1 created_by_id { 1 }
updated_by_id 1 updated_by_id { 1 }
factory :agent_role do factory :agent_role do
permissions { Permission.where(name: 'ticket.agent') } permissions { Permission.where(name: 'ticket.agent') }

View file

@ -1,25 +1,18 @@
FactoryBot.define do FactoryBot.define do
sequence :test_scheduler_name do |n|
"Testscheduler#{n}"
end
end
FactoryBot.define do
factory :scheduler do factory :scheduler do
name { generate(:test_scheduler_name) } sequence(:name) { |n| "Testscheduler#{n}" }
last_run { Time.zone.now } last_run { Time.zone.now }
pid 1337 pid { 1337 }
prio 1 prio { 1 }
status 'ok' status { 'ok' }
active true active { true }
period { 10.minutes } period { 10.minutes }
running false running { false }
note 'test' note { 'test' }
updated_by_id 1 updated_by_id { 1 }
created_by_id 1 created_by_id { 1 }
created_at 1 created_at { 1 }
updated_at 1 updated_at { 1 }
add_attribute(:method) { 'test' } add_attribute(:method) { 'test' }
end end
end end

View file

@ -1,14 +1,8 @@
FactoryBot.define do
sequence :test_signature_name do |n|
"Test signature #{n}"
end
end
FactoryBot.define do FactoryBot.define do
factory :signature do factory :signature do
name { generate(:test_signature_name) } sequence(:name) { |n| "Test signature #{n}" }
body '#{user.firstname} #{user.lastname}'.text2html # rubocop:disable Lint/InterpolationCheck body { '#{user.firstname} #{user.lastname}'.text2html } # rubocop:disable Lint/InterpolationCheck
created_by_id 1 created_by_id { 1 }
updated_by_id 1 updated_by_id { 1 }
end end
end end

View file

@ -1,13 +1,11 @@
FactoryBot.define do FactoryBot.define do
factory :taskbar do factory :taskbar do
client_id 123 client_id { 123 }
key 'Ticket-1234' key { 'Ticket-1234' }
add_attribute(:callback) { 'TicketZoom' } add_attribute(:callback) { 'TicketZoom' }
params do params { {} }
{} state {}
end prio { 1 }
state {} notify { false }
prio 1
notify false
end end
end end

View file

@ -1,13 +1,14 @@
FactoryBot.define do FactoryBot.define do
factory :ticket do factory :ticket do
transient do transient do
state_name 'new' state_name { 'new' }
priority_name '2 normal' priority_name { '2 normal' }
end end
title { 'Test Ticket' } association :group, strategy: :create # or else build(:ticket).save fails
group
customer customer
title { 'Test Ticket' }
state { Ticket::State.lookup(name: state_name) } state { Ticket::State.lookup(name: state_name) }
priority { Ticket::Priority.lookup(name: priority_name) } priority { Ticket::Priority.lookup(name: priority_name) }
updated_by_id { 1 } updated_by_id { 1 }

View file

@ -5,7 +5,7 @@ FactoryBot.define do
sender_name { 'Customer' } sender_name { 'Customer' }
end end
ticket association :ticket, strategy: :create # or else build(:ticket_article).save fails
from { 'factory-customer-1@example.com' } from { 'factory-customer-1@example.com' }
to { 'factory-customer-1@example.com' } to { 'factory-customer-1@example.com' }
subject { 'factory article' } subject { 'factory article' }

View file

@ -1,10 +1,7 @@
FactoryBot.define do FactoryBot.define do
factory :'ticket/priority', aliases: %i[ticket_priority] do factory :'ticket/priority', aliases: %i[ticket_priority] do
sequence :name do |n| sequence(:name) { |n| "#{n} urgent" }
"#{n} urgent" updated_by_id { 1 }
end created_by_id { 1 }
updated_by_id { 1 }
created_by_id { 1 }
end end
end end

View file

@ -1,8 +1,8 @@
FactoryBot.define do FactoryBot.define do
factory :'ticket/time_accounting', aliases: %i[ticket_time_accounting] do factory :'ticket/time_accounting', aliases: %i[ticket_time_accounting] do
ticket ticket
time_unit { rand(100) } time_unit { rand(100) }
created_by_id 1 created_by_id { 1 }
trait :for_article do trait :for_article do
ticket_article { create(:'ticket/article', ticket: ticket) } ticket_article { create(:'ticket/article', ticket: ticket) }

View file

@ -1,9 +1,9 @@
FactoryBot.define do FactoryBot.define do
factory :translation do factory :translation do
locale 'de-de' locale { 'de-de' }
source 'date' source { 'date' }
target 'dd/mm/yyyy' target { 'dd/mm/yyyy' }
created_by_id 1 created_by_id { 1 }
updated_by_id 1 updated_by_id { 1 }
end end
end end

View file

@ -1,18 +1,10 @@
FactoryBot.define do FactoryBot.define do
sequence :fingerprint do |n|
"fingerprint#{n}"
end
end
FactoryBot.define do
factory :user_device do factory :user_device do
user_id 1 user_id { 1 }
name 'test 1' name { 'test 1' }
location 'some location' location { 'some location' }
user_agent 'some user agent' user_agent { 'some user agent' }
ip '127.0.0.1' ip { '127.0.0.1' }
fingerprint { generate(:fingerprint) } sequence(:fingerprint) { |n| "fingerprint#{n}" }
end end
end end

View file

@ -4,8 +4,6 @@ FactoryBot.define do
# mocked_entry = build(:ldap_entry) # mocked_entry = build(:ldap_entry)
# mocked_entry['attr'] = [value, another_value] # mocked_entry['attr'] = [value, another_value]
factory :ldap_entry, class: Net::LDAP::Entry do factory :ldap_entry, class: Net::LDAP::Entry do
initialize_with do initialize_with { new('dc=com') }
new('dc=com')
end
end end
end end

View file

@ -40,7 +40,7 @@ RSpec.describe Ticket, type: :model do
it 'returns a list of unique tickets (i.e., no duplicates)' do it 'returns a list of unique tickets (i.e., no duplicates)' do
expect(Ticket.selectors(condition, limit: 100, access: 'full')) expect(Ticket.selectors(condition, limit: 100, access: 'full'))
.to match_array([2, tickets]) .to match_array([2, tickets.to_a])
end end
end end
end end