test_track_rails_client 7.0.0 → 7.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ef99958de5b5a33d340983ad667aa5232a0209b5e5e2aa0ecb249fe8ba92e35
4
- data.tar.gz: edb76d28b667e451a5b9a284cb90cd3c3eb2a1a55f71471763842dcaf3df052b
3
+ metadata.gz: d4d2661b24f3074456010fedcd9db386a21203d01012a8a7d994305b85e81830
4
+ data.tar.gz: f5b831de28f2b7543be6e53649d212670edc2561970e05cfd6e7758e08db348a
5
5
  SHA512:
6
- metadata.gz: 7fce8893812f7ce818b849e471d77cc4f8ce596189ef8a7f1b9aedfa17761b951f0cfcfedbee317e772562c640a5f303f37e52bff03bfd36220a3c67a49b6c0c
7
- data.tar.gz: 668e3db85f8939b1322ec4fb821381278ac0331d41ccdc75cb460b6787f3b8e3e6ed5ae101b42f71bba003f76a13297879faf5e870895ac6876fbbb4769e244c
6
+ metadata.gz: 7726be38a0eb5b6d81a555b9dd489d1e2d0a33faf30481f922d0faf1a7a79bd150f5e66ce541bc5eb9dcb51c17c0fa2da003a67b316ea3ec124955cf1b98240a
7
+ data.tar.gz: ffceabaffbeb7966c1de27b47f3e820d1a4322fcd871371ba1c90e4fa3d6ea5d8679caae0082ee1a9580341265b96f897125d6c9c9b89f7880011926ee076e88
data/Rakefile CHANGED
@@ -28,12 +28,12 @@ RuboCop::RakeTask.new
28
28
 
29
29
  desc "Pull the latest versions of all dependencies into the gem for distribution"
30
30
  task :vendor_deps do
31
- TEST_TRACK_JS_CLIENT_VERSION = '2.0.0'.freeze
32
- TEST_TRACK_CLI_VERSION = 'v1.2.0'.freeze
31
+ test_track_js_client_version = '2.0.0'.freeze
32
+ test_track_cli_version = 'v1.2.0'.freeze
33
33
 
34
34
  # Bundle JS client
35
35
  sh 'npm init -y'
36
- sh "npm install --no-save test_track_js_client@#{TEST_TRACK_JS_CLIENT_VERSION}"
36
+ sh "npm install --no-save test_track_js_client@#{test_track_js_client_version}"
37
37
  sh 'cp', 'node_modules/test_track_js_client/dist/testTrack.bundle.js', 'app/assets/javascripts/testTrack.bundle.min.js'
38
38
  sh 'rm package.json'
39
39
 
@@ -44,7 +44,7 @@ task :vendor_deps do
44
44
  rm_r Dir.glob('*')
45
45
 
46
46
  %w(darwin linux).each do |arch|
47
- `curl -L https://github.com/Betterment/testtrack-cli/releases/download/#{TEST_TRACK_CLI_VERSION}/testtrack.#{arch} \
47
+ `curl -L https://github.com/Betterment/testtrack-cli/releases/download/#{test_track_cli_version}/testtrack.#{arch} \
48
48
  > testtrack.#{arch}`
49
49
  chmod 'u=wrx,go=rx', "testtrack.#{arch}"
50
50
  end
@@ -27,10 +27,8 @@ module TestTrack::Controller
27
27
  test_track_session.visitor_dsl
28
28
  end
29
29
 
30
- def manage_test_track_session
30
+ def manage_test_track_session(&block)
31
31
  RequestStore[:test_track_web_session] = test_track_session
32
- test_track_session.manage do
33
- yield
34
- end
32
+ test_track_session.manage(&block)
35
33
  end
36
34
  end
@@ -1,7 +1,7 @@
1
1
  class TestTrack::AbConfiguration
2
2
  include TestTrack::RequiredOptions
3
3
 
4
- def initialize(opts) # rubocop:disable Metrics/AbcSize
4
+ def initialize(opts)
5
5
  @split_name = require_option!(opts, :split_name).to_s
6
6
  true_variant = require_option!(opts, :true_variant, allow_nil: true)
7
7
  @split_registry = require_option!(opts, :split_registry)
@@ -12,7 +12,7 @@ class TestTrack::ApplicationIdentity
12
12
  end
13
13
 
14
14
  def identity
15
- Identity.new(app_name)
15
+ @identity ||= Identity.new(app_name)
16
16
  end
17
17
 
18
18
  class Identity
@@ -5,7 +5,7 @@ class TestTrack::IdentitySessionLocator
5
5
  @identity = identity
6
6
  end
7
7
 
8
- def with_visitor # rubocop:disable Metrics/AbcSize
8
+ def with_visitor(&block) # rubocop:disable Metrics/AbcSize
9
9
  raise ArgumentError, "must provide block to `with_visitor`" unless block_given?
10
10
 
11
11
  if web_session.present?
@@ -13,9 +13,7 @@ class TestTrack::IdentitySessionLocator
13
13
  elsif job_session.present?
14
14
  yield job_session.visitor_dsl_for(identity)
15
15
  else
16
- TestTrack::OfflineSession.with_visitor_for(identity.test_track_identifier_type, identity.test_track_identifier_value) do |v|
17
- yield v
18
- end
16
+ TestTrack::OfflineSession.with_visitor_for(identity.test_track_identifier_type, identity.test_track_identifier_value, &block)
19
17
  end
20
18
  end
21
19
 
@@ -3,24 +3,20 @@ class TestTrack::OfflineSession
3
3
  @remote_visitor = remote_visitor
4
4
  end
5
5
 
6
- def self.with_visitor_for(identifier_type, identifier_value)
6
+ def self.with_visitor_for(identifier_type, identifier_value, &block)
7
7
  raise ArgumentError, "must provide block to `with_visitor_for`" unless block_given?
8
8
 
9
9
  remote_visitor = TestTrack::Remote::Visitor.from_identifier(identifier_type, identifier_value)
10
10
 
11
- new(remote_visitor).send :manage do |visitor_dsl|
12
- yield visitor_dsl
13
- end
11
+ new(remote_visitor).send(:manage, &block)
14
12
  end
15
13
 
16
- def self.with_visitor_id(visitor_id)
14
+ def self.with_visitor_id(visitor_id, &block)
17
15
  raise ArgumentError, "must provide block to `with_visitor_id`" unless block_given?
18
16
 
19
17
  remote_visitor = TestTrack::Remote::Visitor.find(visitor_id)
20
18
 
21
- new(remote_visitor).send :manage do |visitor_dsl|
22
- yield visitor_dsl
23
- end
19
+ new(remote_visitor).send(:manage, &block)
24
20
  end
25
21
 
26
22
  private
@@ -33,6 +33,7 @@ class TestTrack::VaryDsl
33
33
  private
34
34
 
35
35
  attr_reader :split_registry, :assignment, :context
36
+
36
37
  delegate :split_name, to: :assignment
37
38
 
38
39
  def split
@@ -51,7 +51,7 @@ class TestTrack::WebSession
51
51
  attr_reader :controller
52
52
 
53
53
  def current_identity
54
- raise <<~ERROR unless controller.class.test_track_identity&.is_a?(Symbol)
54
+ raise <<~ERROR unless controller.class.test_track_identity.is_a?(Symbol)
55
55
  Your controller (or controller base class) must set test_track_identity for
56
56
  TestTrack to work properly. e.g.:
57
57
 
@@ -106,7 +106,7 @@ class TestTrack::WebSession
106
106
  end
107
107
 
108
108
  def wildcard_domain
109
- "." + (public_suffix_domain || request.host)
109
+ ".#{public_suffix_domain || request.host}"
110
110
  end
111
111
 
112
112
  def public_suffix_domain
data/lib/test_track.rb CHANGED
@@ -17,7 +17,7 @@ module TestTrack
17
17
 
18
18
  SERVER_ERRORS = [Faraday::ConnectionFailed, Faraday::TimeoutError, Her::Errors::RemoteServerError].freeze
19
19
  BUILD_TIMESTAMP_FILE_PATH = 'testtrack/build_timestamp'.freeze
20
- BUILD_TIMESTAMP_REGEX = /\A\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d(.\d+)?([+-][0-2]\d:[0-5]\d|Z)\z/.freeze
20
+ BUILD_TIMESTAMP_REGEX = /\A\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d(.\d+)?([+-][0-2]\d:[0-5]\d|Z)\z/
21
21
 
22
22
  mattr_accessor :enabled_override, :app_name
23
23
  mattr_accessor(:job_base_class_name) { 'ActiveJob::Base' }
@@ -9,5 +9,9 @@ module TestTrackRailsClient
9
9
  config.generators do |g|
10
10
  g.test_framework :rspec
11
11
  end
12
+
13
+ initializer after: 'active_support.initialize_time_zone' do
14
+ TestTrack.set_build_timestamp! unless ENV['SKIP_TESTTRACK_SET_BUILD_TIMESTAMP'] == '1'
15
+ end
12
16
  end
13
17
  end
@@ -1,3 +1,3 @@
1
1
  module TestTrackRailsClient
2
- VERSION = "7.0.0".freeze
2
+ VERSION = "7.1.2".freeze
3
3
  end
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: 7.0.0
4
+ version: 7.1.2
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: 2023-03-06 00:00:00.000000000 Z
16
+ date: 2024-07-24 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: activejob
@@ -217,14 +217,14 @@ dependencies:
217
217
  requirements:
218
218
  - - "~>"
219
219
  - !ruby/object:Gem::Version
220
- version: 0.81.0
220
+ version: 1.48.0
221
221
  type: :development
222
222
  prerelease: false
223
223
  version_requirements: !ruby/object:Gem::Requirement
224
224
  requirements:
225
225
  - - "~>"
226
226
  - !ruby/object:Gem::Version
227
- version: 0.81.0
227
+ version: 1.48.0
228
228
  - !ruby/object:Gem::Dependency
229
229
  name: rubocop-performance
230
230
  requirement: !ruby/object:Gem::Requirement
@@ -382,7 +382,6 @@ files:
382
382
  - app/views/tt/api/v1/split_details/show.json.jbuilder
383
383
  - app/views/tt/api/v1/visitors/_show.json.jbuilder
384
384
  - app/views/tt/api/v1/visitors/show.json.jbuilder
385
- - config/initializers/set_build_timestamp.rb
386
385
  - config/initializers/test_track_api.rb
387
386
  - config/routes.rb
388
387
  - lib/generators/test_track/migration_generator.rb
@@ -447,14 +446,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
447
446
  requirements:
448
447
  - - ">="
449
448
  - !ruby/object:Gem::Version
450
- version: 2.7.0
449
+ version: '3.0'
451
450
  required_rubygems_version: !ruby/object:Gem::Requirement
452
451
  requirements:
453
452
  - - ">="
454
453
  - !ruby/object:Gem::Version
455
454
  version: '0'
456
455
  requirements: []
457
- rubygems_version: 3.2.33
456
+ rubygems_version: 3.5.15
458
457
  signing_key:
459
458
  specification_version: 4
460
459
  summary: Rails client for TestTrack
@@ -1 +0,0 @@
1
- TestTrack.set_build_timestamp! unless ENV['SKIP_TESTTRACK_SET_BUILD_TIMESTAMP'] == '1'