marty 2.3.14 → 2.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/app/models/marty/delorean_rule.rb +2 -3
- data/lib/marty/util.rb +15 -0
- data/lib/marty/version.rb +1 -1
- data/spec/controllers/job_controller_spec.rb +1 -1
- data/spec/features/enum_spec.rb +2 -2
- data/spec/features/log_view_spec.rb +5 -5
- data/spec/features/rule_spec.rb +30 -30
- data/spec/features/user_view_spec.rb +2 -0
- data/spec/lib/logger_spec.rb +1 -1
- data/spec/models/event_spec.rb +1 -1
- data/spec/models/promise_spec.rb +1 -1
- data/spec/models/user_spec.rb +6 -6
- data/spec/spec_helper.rb +9 -69
- data/spec/support/chromedriver.rb +41 -0
- data/spec/support/components/netzke_combobox.rb +57 -0
- data/spec/support/components/netzke_grid.rb +356 -0
- data/spec/support/custom_matchers.rb +18 -0
- data/spec/support/custom_selectors.rb +49 -0
- data/spec/support/delayed_job_helpers.rb +1 -1
- data/spec/support/download_helper.rb +52 -0
- data/spec/support/helper.rb +20 -0
- data/spec/support/netzke.rb +306 -0
- data/spec/support/performance_helper.rb +26 -0
- data/spec/support/post_run_logger.rb +32 -0
- data/spec/support/{spec_setup.rb → setup.rb} +19 -6
- data/spec/support/shared_connection.rb +31 -0
- data/spec/support/{clean_db_helpers.rb → shared_connection_db_helpers.rb} +2 -2
- data/spec/support/structure_compare.rb +62 -0
- data/spec/support/suite.rb +27 -0
- data/spec/support/{integration_helpers.rb → users.rb} +11 -9
- metadata +18 -6
- data/spec/support/user_helpers.rb +0 -12
@@ -0,0 +1,31 @@
|
|
1
|
+
require Pathname.new(__FILE__).parent.to_s + '/shared_connection_db_helpers'
|
2
|
+
|
3
|
+
module Marty; module RSpec; module SharedConnection
|
4
|
+
@@classes_to_exclude_from_shared = ['Marty::Log']
|
5
|
+
mattr_accessor :classes_to_exclude_from_shared
|
6
|
+
|
7
|
+
EXCL_LAMBDA = lambda { classes_to_exclude_from_shared }.freeze
|
8
|
+
|
9
|
+
class ActiveRecord::Base
|
10
|
+
mattr_accessor :shared_connection
|
11
|
+
class << self
|
12
|
+
alias_method :orig_connection, :connection
|
13
|
+
end
|
14
|
+
def self.clear_connection
|
15
|
+
@@shared_connection = nil
|
16
|
+
end
|
17
|
+
|
18
|
+
clear_connection
|
19
|
+
|
20
|
+
def self.connection
|
21
|
+
EXCL_LAMBDA.call.include?(model_name) ? orig_connection :
|
22
|
+
@@shared_connection ||
|
23
|
+
ConnectionPool::Wrapper.new(:size => 1) {retrieve_connection}
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.reset_shared_connection
|
27
|
+
@@shared_connection = ConnectionPool::Wrapper.
|
28
|
+
new(:size => 1) {retrieve_connection}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end end end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Marty; module RSpec; module SharedConnectionDbHelpers
|
2
2
|
def current_db
|
3
3
|
ActiveRecord::Base.connection_config[:database]
|
4
4
|
end
|
@@ -15,4 +15,4 @@ module CleanDbHelpers
|
|
15
15
|
ActiveRecord::Base.reset_shared_connection
|
16
16
|
self.use_transactional_tests = true
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end end end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Marty::RSpec::StructureCompare
|
2
|
+
def self.struct_compare_all(v1raw, v2raw, path=[], errs=[])
|
3
|
+
pathstr = path.map(&:to_s).join
|
4
|
+
v1,v2 = [v1raw, v2raw].map { |v| v.class == ActiveSupport::TimeWithZone ?
|
5
|
+
DateTime.parse(v.to_s) : v }
|
6
|
+
|
7
|
+
return errs + [v1["error"]] if
|
8
|
+
v1.class != v2.class && v1.class == Hash && v1["error"]
|
9
|
+
|
10
|
+
return errs + [v2["error"]] if
|
11
|
+
v1.class != v2.class && v2.class == Hash && v2["error"]
|
12
|
+
|
13
|
+
return errs + ["path=#{pathstr} class mismatch #{v1.class} #{v2.class}"] unless
|
14
|
+
v1.class == v2.class ||
|
15
|
+
[v1,v2].map(&:class).to_set == Set.new([Integer, Float])
|
16
|
+
|
17
|
+
case v1
|
18
|
+
when String
|
19
|
+
return errs + ["path=#{pathstr} #{v1} != #{v2}"] unless
|
20
|
+
v1 == v2 ||
|
21
|
+
Regexp.new('\A'+v1+'\z').match(v2) ||
|
22
|
+
Regexp.new('\A'+v2+'\z').match(v1)
|
23
|
+
when Integer, DateTime, TrueClass, FalseClass, NilClass
|
24
|
+
return errs + ["path=#{pathstr} #{v1} != #{v2}"] if v1 != v2
|
25
|
+
when Float
|
26
|
+
return errs + ["path=#{pathstr} #{v1} != #{v2}"] if v1.round(6) != v2.round(6)
|
27
|
+
when Hash
|
28
|
+
v1_v2, v2_v1 = v1.keys-v2.keys, v2.keys-v1.keys
|
29
|
+
|
30
|
+
errs.append("path=#{pathstr} hash extra keys #{v1_v2}") unless v1_v2.empty?
|
31
|
+
errs.append("path=#{pathstr} hash extra keys #{v2_v1}") unless v2_v1.empty?
|
32
|
+
|
33
|
+
return errs + v1.map do |childkey, childval|
|
34
|
+
struct_compare_all(childval, v2[childkey], path + [[childkey]], [])
|
35
|
+
end.flatten
|
36
|
+
when Array
|
37
|
+
errs.append("path=#{pathstr} array size mismatch #{v1.size} != #{v2.size}") if
|
38
|
+
v1.size != v2.size
|
39
|
+
return errs + v1.each_with_index.map do |childval,index|
|
40
|
+
struct_compare_all(childval, v2[index], path + [[index]], [])
|
41
|
+
end.flatten
|
42
|
+
else
|
43
|
+
raise "unhandled #{v1.class}"
|
44
|
+
end
|
45
|
+
errs
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def struct_compare(v1raw, v2raw)
|
50
|
+
begin
|
51
|
+
res = Marty::RSpec::StructureCompare.struct_compare_all(v1raw, v2raw).first
|
52
|
+
rescue => e
|
53
|
+
e.message
|
54
|
+
end
|
55
|
+
end
|
56
|
+
def struct_compare_all(v1raw, v2raw)
|
57
|
+
begin
|
58
|
+
Marty::RSpec::StructureCompare.struct_compare_all(v1raw, v2raw)
|
59
|
+
rescue => e
|
60
|
+
e.message
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
relative = Pathname.new(__FILE__).parent.to_s
|
2
|
+
['setup',
|
3
|
+
'users',
|
4
|
+
'components/netzke_combobox',
|
5
|
+
'components/netzke_grid',
|
6
|
+
'netzke',
|
7
|
+
'download_helper',
|
8
|
+
'chromedriver',
|
9
|
+
'delayed_job_helpers',
|
10
|
+
'post_run_logger',
|
11
|
+
'helper',
|
12
|
+
'performance_helper',
|
13
|
+
'structure_compare',
|
14
|
+
'custom_matchers',
|
15
|
+
'custom_selectors',
|
16
|
+
].each {|f| require (relative + '/' + f)}
|
17
|
+
|
18
|
+
module Marty; module RSpec; module Suite
|
19
|
+
include Marty::RSpec::Setup
|
20
|
+
include Marty::RSpec::Users
|
21
|
+
include Marty::RSpec::Netzke
|
22
|
+
include Marty::RSpec::DelayedJobHelpers
|
23
|
+
include Marty::RSpec::DownloadHelper
|
24
|
+
include Marty::RSpec::PostRunLogger
|
25
|
+
include Marty::RSpec::PerformanceHelper
|
26
|
+
include Marty::RSpec::StructureCompare
|
27
|
+
end end end
|
@@ -1,5 +1,4 @@
|
|
1
|
-
module Marty
|
2
|
-
# test setup helpers
|
1
|
+
module Marty; module RSpec; module Users
|
3
2
|
def populate_test_users
|
4
3
|
(1..2).each { |i|
|
5
4
|
Rails.configuration.marty.roles.each { |role_name|
|
@@ -30,12 +29,15 @@ module Marty::IntegrationHelpers
|
|
30
29
|
user.save
|
31
30
|
end
|
32
31
|
|
33
|
-
def
|
34
|
-
|
35
|
-
|
36
|
-
ensure_on("/")
|
37
|
-
log_in(username, Rails.configuration.marty.local_password)
|
38
|
-
ensure_on("/")
|
32
|
+
def system_user
|
33
|
+
Marty::User.find_by_login('marty') # (system_login)
|
39
34
|
end
|
40
35
|
|
41
|
-
|
36
|
+
def create_user(name)
|
37
|
+
Marty::User.find_or_create_by!(login: name,
|
38
|
+
firstname: name,
|
39
|
+
lastname: 'test',
|
40
|
+
active: true)
|
41
|
+
|
42
|
+
end
|
43
|
+
end end end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arman Bostani
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2018-
|
17
|
+
date: 2018-11-08 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: pg
|
@@ -1681,11 +1681,23 @@ files:
|
|
1681
1681
|
- spec/other/diagnostic/reporter_spec.rb
|
1682
1682
|
- spec/requests/routes_spec.rb
|
1683
1683
|
- spec/spec_helper.rb
|
1684
|
-
- spec/support/
|
1684
|
+
- spec/support/chromedriver.rb
|
1685
|
+
- spec/support/components/netzke_combobox.rb
|
1686
|
+
- spec/support/components/netzke_grid.rb
|
1687
|
+
- spec/support/custom_matchers.rb
|
1688
|
+
- spec/support/custom_selectors.rb
|
1685
1689
|
- spec/support/delayed_job_helpers.rb
|
1686
|
-
- spec/support/
|
1687
|
-
- spec/support/
|
1688
|
-
- spec/support/
|
1690
|
+
- spec/support/download_helper.rb
|
1691
|
+
- spec/support/helper.rb
|
1692
|
+
- spec/support/netzke.rb
|
1693
|
+
- spec/support/performance_helper.rb
|
1694
|
+
- spec/support/post_run_logger.rb
|
1695
|
+
- spec/support/setup.rb
|
1696
|
+
- spec/support/shared_connection.rb
|
1697
|
+
- spec/support/shared_connection_db_helpers.rb
|
1698
|
+
- spec/support/structure_compare.rb
|
1699
|
+
- spec/support/suite.rb
|
1700
|
+
- spec/support/users.rb
|
1689
1701
|
homepage: https://github.com/arman000/marty
|
1690
1702
|
licenses:
|
1691
1703
|
- MIT
|