Sha256: dea3b03c400301cf30d7cd707efd3bbd460c3b76acd2c0e9ae694bf1923ca604

Contents?: true

Size: 871 Bytes

Versions: 33

Compression:

Stored size: 871 Bytes

Contents

module TestTrackRailsClient::AssignmentHelper
  def stub_test_track_assignments(assignment_registry) # rubocop:disable Metrics/AbcSize
    raise "Cannot stub test track assignments when TestTrack is enabled" if TestTrack.enabled?

    split_registry = TestTrack::Fake::SplitRegistry.instance.to_h.dup
    assignments = []

    assignment_registry.each do |split_name, variant|
      split_registry[split_name] = { variant => 100 } unless split_registry[split_name]
      assignments << { split_name: split_name.to_s, variant: variant.to_s, unsynced: false }
    end

    visitor_attributes = { id: "fake_visitor_id", assignments: assignments }

    allow(TestTrack::Remote::Visitor).to receive(:fake_instance_attributes).and_return(visitor_attributes)
    allow(TestTrack::Remote::SplitRegistry).to receive(:fake_instance_attributes).and_return(split_registry)
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
test_track_rails_client-4.0.0.alpha25 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha24 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha23 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha22 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha21 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha20 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha19 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha18 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha17 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha16 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha15 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha14 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha13 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha12 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha11 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha10 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha9 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha8 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha7 lib/test_track_rails_client/assignment_helper.rb
test_track_rails_client-4.0.0.alpha6 lib/test_track_rails_client/assignment_helper.rb