Sha256: 6b76e76fbceeccec1351d4c05f546a584e5f457da4831f131b075fc78321d004

Contents?: true

Size: 1.03 KB

Versions: 27

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true
require "spec_helper"

describe Split::Algorithms::Whiplash do

  it "should return an algorithm" do
    experiment = Split::ExperimentCatalog.find_or_create('link_color', {'blue' => 1}, {'red' => 1 })
    expect(Split::Algorithms::Whiplash.choose_alternative(experiment).class).to eq(Split::Alternative)
  end

  it "should return one of the results" do
    experiment = Split::ExperimentCatalog.find_or_create('link_color', {'blue' => 1}, {'red' => 1 })
    expect(['red', 'blue']).to include Split::Algorithms::Whiplash.choose_alternative(experiment).name
  end

  it "should guess floats" do
    expect(Split::Algorithms::Whiplash.send(:arm_guess, 0, 0).class).to eq(Float)
    expect(Split::Algorithms::Whiplash.send(:arm_guess, 1, 0).class).to eq(Float)
    expect(Split::Algorithms::Whiplash.send(:arm_guess, 2, 1).class).to eq(Float)
    expect(Split::Algorithms::Whiplash.send(:arm_guess, 1000, 5).class).to eq(Float)
    expect(Split::Algorithms::Whiplash.send(:arm_guess, 10, -2).class).to eq(Float)
  end

end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
split-4.0.1 spec/algorithms/whiplash_spec.rb
split-4.0.0.pre2 spec/algorithms/whiplash_spec.rb
split-4.0.0.pre spec/algorithms/whiplash_spec.rb
ab-split-1.0.2 spec/algorithms/whiplash_spec.rb
ab-split-1.0.1 spec/algorithms/whiplash_spec.rb
ab-split-1.0.0 spec/algorithms/whiplash_spec.rb
split-3.4.1 spec/algorithms/whiplash_spec.rb
split-3.4.0 spec/algorithms/whiplash_spec.rb
split-3.3.2 spec/algorithms/whiplash_spec.rb
split-3.3.1 spec/algorithms/whiplash_spec.rb
split-3.3.0 spec/algorithms/whiplash_spec.rb
split-3.2.0 spec/algorithms/whiplash_spec.rb
split-3.1.1 spec/algorithms/whiplash_spec.rb
split-3.1.0 spec/algorithms/whiplash_spec.rb
split-3.0.0 spec/algorithms/whiplash_spec.rb
split-2.2.0 spec/algorithms/whiplash_spec.rb
split-2.1.0 spec/algorithms/whiplash_spec.rb
split-2.0.0 spec/algorithms/whiplash_spec.rb
split-1.7.0 spec/algorithms/whiplash_spec.rb
split-1.6.0 spec/algorithms/whiplash_spec.rb