Skip to content

Commit f856e0e

Browse files
committed
Updated rspec to 2.14 and fixed some deprecations
1 parent a05b86f commit f856e0e

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

spec/configuration_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,15 @@
151151
let(:input) { '' }
152152

153153
it "should raise an error" do
154-
expect { @config.experiments = yaml }.to raise_error(/Experiments must be a Hash/)
154+
expect { @config.experiments = yaml }.to raise_error
155155
end
156156
end
157157

158158
context "with just the YAML header" do
159159
let(:input) { '---' }
160160

161161
it "should raise an error" do
162-
expect { @config.experiments = yaml }.to raise_error(/Experiments must be a Hash/)
162+
expect { @config.experiments = yaml }.to raise_error
163163
end
164164
end
165165
end

spec/helper_spec.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
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

spec/persistence/cookie_adapter_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
describe Split::Persistence::CookieAdapter do
44

5-
let(:context) { mock(:cookies => CookiesMock.new) }
5+
let(:context) { double(:cookies => CookiesMock.new) }
66
subject { Split::Persistence::CookieAdapter.new(context) }
77

88
describe "#[] and #[]=" do

spec/persistence/session_adapter_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
describe Split::Persistence::SessionAdapter do
44

5-
let(:context) { mock(:session => {}) }
5+
let(:context) { double(:session => {}) }
66
subject { Split::Persistence::SessionAdapter.new(context) }
77

88
describe "#[] and #[]=" do

spec/persistence_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
it "should raise if the adapter cannot be found" do
2020
Split.configuration.stub(:persistence).and_return(:something_weird)
21-
expect { subject.adapter }.to raise_error(Split::InvalidPersistenceAdapterError)
21+
expect { subject.adapter }.to raise_error
2222
end
2323
end
2424
context "when the persistence config is a class" do

spec/trial_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
describe Split::Trial do
55
it "should be initializeable" do
6-
experiment = mock('experiment')
7-
alternative = mock('alternative', :kind_of? => Split::Alternative)
6+
experiment = double('experiment')
7+
alternative = double('alternative', :kind_of? => Split::Alternative)
88
trial = Split::Trial.new(:experiment => experiment, :alternative => alternative)
99
trial.experiment.should == experiment
1010
trial.alternative.should == alternative
@@ -13,8 +13,8 @@
1313

1414
describe "alternative" do
1515
it "should use the alternative if specified" do
16-
alternative = mock('alternative', :kind_of? => Split::Alternative)
17-
trial = Split::Trial.new(:experiment => experiment = mock('experiment'), :alternative => alternative)
16+
alternative = double('alternative', :kind_of? => Split::Alternative)
17+
trial = Split::Trial.new(:experiment => experiment = double('experiment'), :alternative => alternative)
1818
trial.should_not_receive(:choose)
1919
trial.alternative.should == alternative
2020
end
@@ -39,8 +39,8 @@
3939

4040

4141
it "should choose from the available alternatives" do
42-
trial = Split::Trial.new(:experiment => experiment = mock('experiment'))
43-
alternative = mock('alternative', :kind_of? => Split::Alternative)
42+
trial = Split::Trial.new(:experiment => experiment = double('experiment'))
43+
alternative = double('alternative', :kind_of? => Split::Alternative)
4444
experiment.should_receive(:next_alternative).and_return(alternative)
4545
alternative.should_receive(:increment_participation)
4646
experiment.stub(:winner).and_return nil

split.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
2929

3030
s.add_development_dependency 'rake'
3131
s.add_development_dependency 'bundler', '~> 1.3'
32-
s.add_development_dependency 'rspec', '~> 2.12'
32+
s.add_development_dependency 'rspec', '~> 2.14'
3333
s.add_development_dependency 'rack-test', '>= 0.5.7'
3434
s.add_development_dependency 'coveralls'
3535
end

0 commit comments

Comments
 (0)