RSpec & COBOL
Published about 6 years ago

It’s a pretty saturday morning and I am in very jolly mood. Thought I’d share some joy ;-)

In 1959, there was COBOL

ADD YEARS TO AGE.
MULTIPLY PRICE BY QUANTITY GIVING COST.
SUBTRACT DISCOUNT FROM COST GIVING FINAL-COST.
MULTIPLY B BY B GIVING B-SQUARED.  
MULTIPLY 4 BY A GIVING FOUR-A.  
MULTIPLY FOUR-A BY C GIVING FOUR-A-C.  
SUBTRACT FOUR-A-C FROM B-SQUARED GIVING RESULT-1.  
COMPUTE RESULT-2 = RESULT-1 ** .5.
SUBTRACT B FROM RESULT-2 GIVING NUMERATOR.
MULTIPLY 2 BY A GIVING DENOMINATOR.
DIVIDE NUMERATOR BY DENOMINATOR GIVING X.

And almost 50 years later, it resurrected !

Scenario: savings account has insufficient funds
Given my savings account balance is $50
And my checking account balance is $10
When I transfer $60 from savings to checking
Then my savings account balance should be $50
And my checking account balance should be $10

I know history repeats itself. I just wish it wouldn’t have done it in English !