spec/scenarios_spec.rb in attempt_this-1.0.0 vs spec/scenarios_spec.rb in attempt_this-1.0.1
- old
+ new
@@ -7,45 +7,41 @@
AttemptThis.reset
end
context 'validation' do
it 'should reject nil scenario id' do
- ->{AttemptThis.attempt(3.times).scenario(nil)}.should raise_error(ArgumentError)
+ lambda{AttemptThis.attempt(3.times).scenario(nil)}.should raise_error(ArgumentError)
end
- it 'should reject empty scenario id' do
- ->{AttemptThis.attempt(3.times).scenario('')}.should raise_error(ArgumentError)
- end
-
it 'should accept string ids' do
- ->{AttemptThis.attempt(3.times).scenario('uploads')}.should_not raise_error
+ lambda{AttemptThis.attempt(3.times).scenario('uploads')}.should_not raise_error
end
it 'should accept symbol ids' do
- ->{AttemptThis.attempt(3.times).scenario(:uploads)}.should_not raise_error
+ lambda{AttemptThis.attempt(3.times).scenario(:uploads)}.should_not raise_error
end
it 'should reject duplicate names' do
AttemptThis.attempt(3.times).scenario(:uploads)
- ->{AttemptThis.attempt(3.times).scenario(:uploads)}.should raise_error(ArgumentError)
+ lambda{AttemptThis.attempt(3.times).scenario(:uploads)}.should raise_error(ArgumentError)
end
end
context 'operation' do
it 'should attempt given number of times' do
AttemptThis.attempt(3.times).scenario(:test)
count = 0
- ->{attempt(:test) { count += 1; raise 'Test' }}.should raise_error('Test')
+ lambda{attempt(:test) { count += 1; raise 'Test' }}.should raise_error('Test')
count.should eql(3)
end
it 'should reuse scenario' do
AttemptThis.attempt(3.times).scenario(:test)
- ->{attempt(:test) { raise 'Test'}}.should raise_error('Test')
+ lambda{attempt(:test) { raise 'Test'}}.should raise_error('Test')
count = 0
- ->{attempt(:test) {count += 1; raise 'Test'}}.should raise_error('Test')
+ lambda{attempt(:test) {count += 1; raise 'Test'}}.should raise_error('Test')
count.should eql(3)
end
end
end