Imperative und deklarative Schritte in Rspec

Ich frage mich, worum es in Rspec bei imperativen vs deklarativen Schritten geht.

Hier ist ein Beispielcode aus dem Rspec-Buch:

Scenario: transfer money (declarative)
Given I have $100 in checking
And I have $20 in savings
When I transfer $15 from checking to savings
Then I should have $85 in checking
And I should have $35 in savings

Scenario: transfer money (imperative)
Given I have $100 in checking
And I have $20 in savings
When I go to the transfer form
And I select "Checking" from "Source Account"
And I select "Savings" from "Target Account"
And I fill in "Amount" with "15"
And I press "Execute Transfer"
Then I should see that I have $85 in checking
And I should see that I have $35 in savings

Ich verstehe das Bild nicht ganz.

Was ich verstanden habe, ist, dass deklarativ Sie tun lassen, was Sie wollen, solange das Ergebnis vergeht, und imperativ ist ausführlicher.

Allerdings habe ich nicht das Gefühl, dass ich den Sinn davon habe.

Könnte jemand dies ein bisschen mehr erklären. Was sind die Unterschiede und welchen soll ich wählen?

Antworten auf die Frage(2)

Ihre Antwort auf die Frage