Sha256: c22085bfd09e1e5f2aff6f2d96256b296a57934d02e781411f198dd2a14b2d40

Contents?: true

Size: 977 Bytes

Versions: 7

Compression:

Stored size: 977 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

7 entries across 7 versions & 1 rubygems

Version Path
split-0.6.5 spec/algorithms/whiplash_spec.rb
split-0.6.4 spec/algorithms/whiplash_spec.rb
split-0.6.3 spec/algorithms/whiplash_spec.rb
split-0.6.2 spec/algorithms/whiplash_spec.rb
split-0.6.1 spec/algorithms/whiplash_spec.rb
split-0.6.0 spec/algorithms/whiplash_spec.rb
split-0.5.0 spec/algorithms/whiplash_spec.rb