Sha256: ac9d4ffddb6cf97ecb024c3c9c00a70015476742be79e0fba12260c909c76497

Contents?: true

Size: 973 Bytes

Versions: 4

Compression:

Stored size: 973 Bytes

Contents

require "spec_helper"

describe Split::Algorithms::Whiplash do

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

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

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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
split-0.7.2 spec/algorithms/whiplash_spec.rb
split-0.7.1 spec/algorithms/whiplash_spec.rb
split-0.7.0 spec/algorithms/whiplash_spec.rb
split-0.6.6 spec/algorithms/whiplash_spec.rb