spec/alternative_spec.rb in split-0.7.0 vs spec/alternative_spec.rb in split-0.7.1
- old
+ new
@@ -9,36 +9,26 @@
let(:alternative2) {
Split::Alternative.new('Cart', 'basket_text')
}
- let(:experiment) {
+ let!(:experiment) {
Split::Experiment.find_or_create({"basket_text" => ["purchase", "refund"]}, "Basket", "Cart")
}
let(:goal1) { "purchase" }
let(:goal2) { "refund" }
- # setup experiment
- before do
- experiment
- end
-
it "should have goals" do
alternative.goals.should eql(["purchase", "refund"])
end
- it "should have a name" do
+ it "should have and only return the name" do
alternative.name.should eql('Basket')
end
- it "return only the name" do
- alternative.name.should eql('Basket')
- end
-
describe 'weights' do
-
it "should set the weights" do
experiment = Split::Experiment.new('basket_text', :alternatives => [{'Basket' => 0.6}, {"Cart" => 0.4}])
first = experiment.alternatives[0]
first.name.should == 'Basket'
first.weight.should == 0.6
@@ -246,10 +236,10 @@
control.participant_count = 126
control.set_completed_count(89)
alternative2.participant_count = 142
alternative2.set_completed_count(119)
-
+
alternative2.z_score.round(2).should eql(2.58)
end
it "should be N/A for the control" do
control = experiment.control