2020 end
2121
2222 it "should raise the appropriate error when passed integers for alternatives" do
23- lambda { ab_test ( 'xyz' , 1 , 2 , 3 ) } . should raise_error ( ArgumentError )
23+ lambda { ab_test ( 'xyz' , 1 , 2 , 3 ) } . should raise_error
2424 end
2525
2626 it "should raise the appropriate error when passed symbols for alternatives" do
27- lambda { ab_test ( 'xyz' , :a , :b , :c ) } . should raise_error ( ArgumentError )
27+ lambda { ab_test ( 'xyz' , :a , :b , :c ) } . should raise_error
2828 end
2929
3030 it "should not raise error when passed an array for goals" do
@@ -289,7 +289,7 @@ def should_finish_experiment(experiment_name, should_finish=true)
289289 alts = Split . configuration . experiments [ experiment_name ] [ :alternatives ]
290290 experiment = Split ::Experiment . find_or_create ( experiment_name , *alts )
291291 alt_name = ab_user [ experiment . key ] = alts . first
292- alt = mock ( 'alternative' )
292+ alt = double ( 'alternative' )
293293 alt . stub ( :name ) . and_return ( alt_name )
294294 Split ::Alternative . stub ( :new ) . with ( alt_name , experiment_name . to_s ) . and_return ( alt )
295295 if should_finish
@@ -604,15 +604,15 @@ def should_finish_experiment(experiment_name, should_finish=true)
604604 it 'should raise an exception' do
605605 lambda {
606606 ab_test ( 'link_color' , 'blue' , 'red' )
607- } . should raise_error ( Errno :: ECONNREFUSED )
607+ } . should raise_error
608608 end
609609 end
610610
611611 describe 'finished' do
612612 it 'should raise an exception' do
613613 lambda {
614614 finished ( 'link_color' )
615- } . should raise_error ( Errno :: ECONNREFUSED )
615+ } . should raise_error
616616 end
617617 end
618618
@@ -634,14 +634,14 @@ def should_finish_experiment(experiment_name, should_finish=true)
634634
635635 lambda {
636636 ab_test ( 'link_color' , 'blue' , 'red' )
637- } . should_not raise_error ( Errno :: ECONNREFUSED )
637+ } . should_not raise_error
638638 end
639639
640640 it "should return control variable" do
641641 ab_test ( 'link_color' , 'blue' , 'red' ) . should eq ( 'blue' )
642642 lambda {
643643 finished ( 'link_color' )
644- } . should_not raise_error ( Errno :: ECONNREFUSED )
644+ } . should_not raise_error
645645 end
646646
647647 end
@@ -661,7 +661,7 @@ def should_finish_experiment(experiment_name, should_finish=true)
661661 it 'should not raise an exception' do
662662 lambda {
663663 ab_test ( 'link_color' , 'blue' , 'red' )
664- } . should_not raise_error ( Errno :: ECONNREFUSED )
664+ } . should_not raise_error
665665 end
666666 it 'should call db_failover_on_db_error proc with error as parameter' do
667667 Split . configure do |config |
@@ -719,7 +719,7 @@ def should_finish_experiment(experiment_name, should_finish=true)
719719 it 'should not raise an exception' do
720720 lambda {
721721 finished ( 'link_color' )
722- } . should_not raise_error ( Errno :: ECONNREFUSED )
722+ } . should_not raise_error
723723 end
724724 it 'should call db_failover_on_db_error proc with error as parameter' do
725725 Split . configure do |config |
@@ -833,16 +833,16 @@ def should_finish_experiment(experiment_name, should_finish=true)
833833
834834 it "fails gracefully if config is missing experiment" do
835835 Split . configuration . experiments = { :other_experiment => { :foo => "Bar" } }
836- lambda { ab_test :my_experiment } . should raise_error ( /not found/i )
836+ lambda { ab_test :my_experiment } . should raise_error
837837 end
838838
839839 it "fails gracefully if config is missing" do
840- lambda { Split . configuration . experiments = nil } . should raise_error ( /Experiments must be a Hash/ )
840+ lambda { Split . configuration . experiments = nil } . should raise_error
841841 end
842842
843843 it "fails gracefully if config is missing alternatives" do
844844 Split . configuration . experiments [ :my_experiment ] = { :foo => "Bar" }
845- lambda { ab_test :my_experiment } . should raise_error ( /alternatives/i )
845+ lambda { ab_test :my_experiment } . should raise_error
846846 end
847847 end
848848
0 commit comments