I try to learn Rspec, but I don’t understand what is that. Let me explain. I have read many articles and blogs and I was able to understand a few things(basic terms, how to install, how to use and other). But I don’t understand the main. What is behavior? Question may seem absurd but I realy don’t understand this.
For example I have simple rails app. Blog. Create articles, comments etc. What is behavior there?
This example maybe is not good.
I can not understand the essence of behavior. What mean this word for object(acticles, comments)?
Can explain me this? Maybe can someone show some examples? What behavior need to testing? And what is behavior?
The simplest explanation of behavior I see is the following.
In OOP objects send and receive messages. Following receive of a message, object behaves, i.e. it changes it’s state or sends messages to another objects.
Testing the behavior you should check if the object behaves correspondingly to a message it received.
BDD states: you first define the behavior via a spec and then write the code to enable object behave as intended.