test_track_rails_client 4.0.0.alpha33 → 4.0.0.alpha34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +1 -1
- data/app/controllers/concerns/test_track/controller.rb +1 -3
- data/app/models/concerns/test_track/required_options.rb +1 -0
- data/app/models/test_track/ab_configuration.rb +2 -4
- data/app/models/test_track/analytics/mixpanel_client.rb +1 -0
- data/app/models/test_track/analytics/safe_wrapper.rb +1 -0
- data/app/models/test_track/application_identity.rb +1 -0
- data/app/models/test_track/assignment.rb +2 -1
- data/app/models/test_track/fake/split_registry.rb +2 -4
- data/app/models/test_track/job_session.rb +1 -3
- data/app/models/test_track/lazy_visitor_by_identity.rb +1 -1
- data/app/models/test_track/misconfiguration_notifier.rb +1 -0
- data/app/models/test_track/notify_assignment_job.rb +1 -0
- data/app/models/test_track/remote/fake_server.rb +1 -0
- data/app/models/test_track/remote/identifier.rb +1 -0
- data/app/models/test_track/variant_calculator.rb +1 -0
- data/app/models/test_track/vary_dsl.rb +4 -0
- data/app/models/test_track/visitor.rb +1 -0
- data/app/models/test_track/web_session.rb +1 -0
- data/app/models/test_track/web_session_visitor_repository.rb +1 -3
- data/lib/test_track.rb +1 -0
- data/lib/test_track_rails_client/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2ebec3b017f9413465d5366f3b94d95c12b38d7bf408693ce0a0d4086d39a107
|
4
|
+
data.tar.gz: '0728b2597327fb1e1583de3c9b4ed3eaf9a7f95bf62617d5cb2702c33d9723d8'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86cbae6aa9be897b607781bb26bd53cc834bf47c140d1d2e7f911baadada95f280094ece25de2a4a2ce1415b20eeb4eb63e472fe60c6dc8a5a2256c6f63ecaab
|
7
|
+
data.tar.gz: 5cf5546c8d41542813f2aa682024ca3b476fc51afa7bd3144d93634982806fbfa7b2827f232de2da459a88118c1c43a26a5cdbab9713d42fd9d22ea739f1b970
|
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
15
|
end
|
16
16
|
|
17
|
-
APP_RAKEFILE = File.expand_path(
|
17
|
+
APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
|
18
18
|
load 'rails/tasks/engine.rake'
|
19
19
|
|
20
20
|
Bundler::GemHelper.install_tasks
|
@@ -12,9 +12,7 @@ module TestTrack::Controller
|
|
12
12
|
class_methods do
|
13
13
|
def require_feature_flag(feature_flag, *args)
|
14
14
|
before_action(*args) do
|
15
|
-
unless test_track_visitor.ab(feature_flag, context: self.class.name.underscore)
|
16
|
-
raise ActionController::RoutingError, 'Not Found'
|
17
|
-
end
|
15
|
+
raise ActionController::RoutingError, 'Not Found' unless test_track_visitor.ab(feature_flag, context: self.class.name.underscore)
|
18
16
|
end
|
19
17
|
end
|
20
18
|
end
|
@@ -6,6 +6,7 @@ module TestTrack::RequiredOptions
|
|
6
6
|
def require_option!(opts, opt_name, my_opts = {})
|
7
7
|
opt_provided = my_opts[:allow_nil] ? opts.key?(opt_name) : opts[opt_name]
|
8
8
|
raise(ArgumentError, "Must provide #{opt_name}") unless opt_provided
|
9
|
+
|
9
10
|
opts.delete(opt_name)
|
10
11
|
end
|
11
12
|
end
|
@@ -19,9 +19,7 @@ class TestTrack::ABConfiguration
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def build_variant_hash
|
22
|
-
if split_variants && split_variants.size > 2
|
23
|
-
notify_because_ab("configures split with more than 2 variants")
|
24
|
-
end
|
22
|
+
notify_because_ab("configures split with more than 2 variants") if split_variants && split_variants.size > 2
|
25
23
|
{ true: true_variant, false: false_variant }
|
26
24
|
end
|
27
25
|
|
@@ -30,7 +28,7 @@ class TestTrack::ABConfiguration
|
|
30
28
|
end
|
31
29
|
|
32
30
|
def false_variant
|
33
|
-
@false_variant ||= non_true_variants.present? ? non_true_variants.
|
31
|
+
@false_variant ||= non_true_variants.present? ? non_true_variants.min : false
|
34
32
|
end
|
35
33
|
|
36
34
|
attr_reader :split_name, :split_registry
|
@@ -9,6 +9,7 @@ module TestTrack::Analytics
|
|
9
9
|
def error_handler=(handler)
|
10
10
|
raise ArgumentError, "error_handler must be a lambda" unless handler.lambda?
|
11
11
|
raise ArgumentError, "error_handler must accept 1 argument" unless handler.arity == 1
|
12
|
+
|
12
13
|
@error_handler = handler
|
13
14
|
end
|
14
15
|
|
@@ -50,9 +50,7 @@ class TestTrack::Fake::SplitRegistry
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def legacy_test_track_schema_yml
|
53
|
-
unless instance_variable_defined?(:@legacy_test_track_schema_yml)
|
54
|
-
@legacy_test_track_schema_yml = _legacy_test_track_schema_yml
|
55
|
-
end
|
53
|
+
@legacy_test_track_schema_yml = _legacy_test_track_schema_yml unless instance_variable_defined?(:@legacy_test_track_schema_yml)
|
56
54
|
@legacy_test_track_schema_yml
|
57
55
|
end
|
58
56
|
|
@@ -69,7 +67,7 @@ class TestTrack::Fake::SplitRegistry
|
|
69
67
|
|
70
68
|
def split_registry_with_deterministic_weights
|
71
69
|
splits = split_hash.each_with_object({}) do |(split_name, weighting_registry), result|
|
72
|
-
default_variant = weighting_registry.keys.
|
70
|
+
default_variant = weighting_registry.keys.min
|
73
71
|
|
74
72
|
adjusted_weights = { default_variant => 100 }
|
75
73
|
weighting_registry.except(default_variant).each_key do |variant|
|
@@ -24,9 +24,7 @@ class TestTrack::JobSession
|
|
24
24
|
|
25
25
|
def notify_unsynced_assignments!
|
26
26
|
identity_visitor_map.each_value do |visitor|
|
27
|
-
if visitor.loaded? && visitor.unsynced_assignments.present?
|
28
|
-
TestTrack::ThreadedVisitorNotifier.new(visitor).notify
|
29
|
-
end
|
27
|
+
TestTrack::ThreadedVisitorNotifier.new(visitor).notify if visitor.loaded? && visitor.unsynced_assignments.present?
|
30
28
|
end
|
31
29
|
end
|
32
30
|
|
@@ -22,6 +22,7 @@ module TestTrack::MisconfigurationNotifier
|
|
22
22
|
class Airbrake
|
23
23
|
def notify(msg)
|
24
24
|
raise "Aibrake was configured but not found" unless defined?(::Airbrake)
|
25
|
+
|
25
26
|
if ::Airbrake.respond_to?(:notify_or_ignore)
|
26
27
|
::Airbrake.notify_or_ignore(StandardError.new, error_message: msg)
|
27
28
|
else
|
@@ -28,6 +28,7 @@ class TestTrack::NotifyAssignmentJob
|
|
28
28
|
def maybe_track
|
29
29
|
return "failure" unless TestTrack.enabled?
|
30
30
|
return "success" if skip_analytics_event?
|
31
|
+
|
31
32
|
result = TestTrack.analytics.track(TestTrack::AnalyticsEvent.new(visitor_id, assignment))
|
32
33
|
result ? "success" : "failure"
|
33
34
|
end
|
@@ -18,6 +18,7 @@ class TestTrack::VaryDSL
|
|
18
18
|
|
19
19
|
def when(*variants, &block)
|
20
20
|
raise ArgumentError, "must provide at least one variant" if variants.blank?
|
21
|
+
|
21
22
|
variants.each do |variant|
|
22
23
|
assign_behavior_to_variant(variant, block)
|
23
24
|
end
|
@@ -25,6 +26,7 @@ class TestTrack::VaryDSL
|
|
25
26
|
|
26
27
|
def default(variant, &block)
|
27
28
|
raise ArgumentError, "cannot provide more than one `default`" unless default_variant.nil?
|
29
|
+
|
28
30
|
@default_variant = assign_behavior_to_variant(variant, block)
|
29
31
|
end
|
30
32
|
|
@@ -57,6 +59,7 @@ class TestTrack::VaryDSL
|
|
57
59
|
variant = variant.to_s
|
58
60
|
|
59
61
|
raise ArgumentError, "must provide block for #{variant}" unless behavior_proc
|
62
|
+
|
60
63
|
notify_because_vary(<<-MESSAGE) if variant_behaviors.include?(variant)
|
61
64
|
configures variant "#{variant}" more than once.
|
62
65
|
This will raise an error in the next version of test_track_rails_client.
|
@@ -93,6 +96,7 @@ class TestTrack::VaryDSL
|
|
93
96
|
raise ArgumentError, "must provide exactly one `default`" unless default_variant
|
94
97
|
raise ArgumentError, "must provide at least one `when`" unless variant_behaviors.size >= 2
|
95
98
|
return true unless split_variants
|
99
|
+
|
96
100
|
missing_variants = split_variants - variant_behaviors.keys
|
97
101
|
notify_because_vary("does not configure variants #{missing_variants.to_sentence}") && false unless missing_variants.empty?
|
98
102
|
end
|
@@ -23,6 +23,7 @@ class TestTrack::Visitor
|
|
23
23
|
raise "unknown opts: #{opts.keys.to_sentence}" if opts.present?
|
24
24
|
|
25
25
|
raise ArgumentError, "must provide block to `vary` for #{split_name}" unless block_given?
|
26
|
+
|
26
27
|
v = TestTrack::VaryDSL.new(assignment: assignment_for(split_name), context: context, split_registry: split_registry)
|
27
28
|
yield v
|
28
29
|
v.send :run
|
@@ -34,9 +34,7 @@ class TestTrack::WebSessionVisitorRepository
|
|
34
34
|
|
35
35
|
def notify_unsynced_assignments!
|
36
36
|
all.each do |visitor|
|
37
|
-
if visitor.loaded? && visitor.unsynced_assignments.present?
|
38
|
-
TestTrack::ThreadedVisitorNotifier.new(visitor).notify
|
39
|
-
end
|
37
|
+
TestTrack::ThreadedVisitorNotifier.new(visitor).notify if visitor.loaded? && visitor.unsynced_assignments.present?
|
40
38
|
end
|
41
39
|
end
|
42
40
|
|
data/lib/test_track.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_track_rails_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.
|
4
|
+
version: 4.0.0.alpha34
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan O'Neill
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2020-01-08 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: delayed_job
|
@@ -134,7 +134,7 @@ dependencies:
|
|
134
134
|
version: '4.1'
|
135
135
|
- - "<"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
137
|
+
version: '7.0'
|
138
138
|
type: :runtime
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -144,7 +144,7 @@ dependencies:
|
|
144
144
|
version: '4.1'
|
145
145
|
- - "<"
|
146
146
|
- !ruby/object:Gem::Version
|
147
|
-
version: '
|
147
|
+
version: '7.0'
|
148
148
|
- !ruby/object:Gem::Dependency
|
149
149
|
name: request_store
|
150
150
|
requirement: !ruby/object:Gem::Requirement
|
@@ -356,8 +356,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
356
356
|
- !ruby/object:Gem::Version
|
357
357
|
version: 1.3.1
|
358
358
|
requirements: []
|
359
|
-
|
360
|
-
rubygems_version: 2.5.1
|
359
|
+
rubygems_version: 3.0.6
|
361
360
|
signing_key:
|
362
361
|
specification_version: 4
|
363
362
|
summary: Rails client for TestTrack
|