spec/attempt_spec.rb in attempt_this-1.0.2 vs spec/attempt_spec.rb in attempt_this-1.0.3
- old
+ new
@@ -13,11 +13,11 @@
end
it 'should execute code block' do
was_called = false
attempt(1.times) {was_called = true}
- was_called.should be true
+ was_called.should be_true
end
it 'should execute the code block only once' do
call_count = 0
attempt(3.times) { call_count += 1 }
@@ -85,11 +85,11 @@
it 'should call the code block' do
was_called = false
attempt(3.times).with_delay(1) do
was_called = true
end
- was_called.should be true
+ was_called.should be_true
end
it 'should not sleep on success' do
Kernel.should_not_receive(:sleep)
attempt(3.times).with_delay(3) {}
@@ -149,22 +149,22 @@
it 'should call the code block' do
was_called = false
attempt(1.times).with_reset(lambda{}) { was_called = true }
- was_called.should be true
+ was_called.should be_true
end
it 'should reject multiple reset procs' do
lambda{attempt(3.times).with_reset(lambda{}).with_reset(lambda{})}.should raise_error(ArgumentError)
end
it 'should not be called on successful calls' do
was_called = false
attempt(1.times).with_reset(lambda{ was_called = true }) {}
- was_called.should be false
+ was_called.should be_false
end
it 'should be called on each failure' do
reset_count = 0
@@ -188,17 +188,17 @@
it 'should call the code block' do
was_called = false
attempt(3.times).and_default_to(lambda{}){ was_called = true }
- was_called.should be true
+ was_called.should be_true
end
it 'should not be called on success' do
was_called = false
attempt(3.times).and_default_to(lambda{ was_called = true }) {}
- was_called.should be false
+ was_called.should be_false
end
it 'should be called once on the failure' do
call_count = 0
attempt(3.times).and_default_to(lambda{ call_count += 1 }){ raise 'Test'}
@@ -209,11 +209,11 @@
it 'should not be called if code block stopped failing' do
call_count = 0
was_called = false
attempt(3.times).and_default_to(lambda{ was_called = true }) { call_count += 1; raise 'Test' if call_count < 2 }
- was_called.should be false
+ was_called.should be_false
end
end
context 'with_binary_backoff' do
it 'should reject nil initial delay' do
@@ -242,11 +242,11 @@
it 'should call the code block' do
was_called = false
attempt(3.times).with_binary_backoff(1) { was_called = true }
- was_called.should be true
+ was_called.should be_true
end
it 'should double delay on each failure' do
Kernel.should_receive(:sleep).ordered.with(1)
Kernel.should_receive(:sleep).ordered.with(2)
@@ -270,11 +270,11 @@
end
it 'should call code within the block' do
was_called = false
attempt(2.times).with_filter(Exception){ was_called = true }
- was_called.should be true
+ was_called.should be_true
end
it 'should ignore other exceptions' do
count = 0
lambda{attempt(3.times).with_filter(StandardError){ count += 1; raise(Exception, 'Test')}}.should raise_error(Exception)
@@ -300,32 +300,32 @@
end
subject{TestAttempt.new}
it 'should be true initially' do
- subject.enabled?.should be true
+ subject.enabled?.should be_true
end
it 'should accept true' do
subject.enabled = true
- subject.enabled?.should be true
+ subject.enabled?.should be_true
end
it 'should accept false' do
subject.enabled = false
- subject.enabled?.should be false
+ subject.enabled?.should be_false
end
it 'should change from true to false' do
subject.enabled = true
subject.enabled = false
- subject.enabled?.should be false
+ subject.enabled?.should be_false
end
it 'should change from false to true' do
subject.enabled = false
subject.enabled = true
- subject.enabled?.should be true
+ subject.enabled?.should be_true
end
context 'when disabled' do
before(:each) do
AttemptThis.stub(:enabled?).and_return(false)