spec/dashboard_spec.rb in split-0.3.0 vs spec/dashboard_spec.rb in split-0.3.1
- old
+ new
@@ -16,34 +16,31 @@
last_response.should be_ok
end
it "should reset an experiment" do
experiment = Split::Experiment.find_or_create('link_color', 'blue', 'red')
- red = Split::Alternative.find('red', 'link_color').participant_count
- red = Split::Alternative.find('red', 'link_color')
- blue = Split::Alternative.find('blue', 'link_color')
+ red = Split::Alternative.new('red', 'link_color')
+ blue = Split::Alternative.new('blue', 'link_color')
red.participant_count = 5
- red.save
blue.participant_count = 6
- blue.save
post '/reset/link_color'
last_response.should be_redirect
- new_red_count = Split::Alternative.find('red', 'link_color').participant_count
- new_blue_count = Split::Alternative.find('blue', 'link_color').participant_count
+ new_red_count = Split::Alternative.new('red', 'link_color').participant_count
+ new_blue_count = Split::Alternative.new('blue', 'link_color').participant_count
new_blue_count.should eql(0)
new_red_count.should eql(0)
end
it "should delete an experiment" do
experiment = Split::Experiment.find_or_create('link_color', 'blue', 'red')
delete '/link_color'
last_response.should be_redirect
- lambda { Split::Experiment.find('link_color') }.should raise_error
+ Split::Experiment.find('link_color').should be_nil
end
it "should mark an alternative as the winner" do
experiment = Split::Experiment.find_or_create('link_color', 'blue', 'red')
experiment.winner.should be_nil
\ No newline at end of file