-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
may need a bit more practice and help #10
base: master
Are you sure you want to change the base?
Conversation
Yes, in all TDD you should go Red, Green, Refactor:
|
|
||
it "should receive slow down from conductor" do | ||
message_board.should_receive(:slow_down!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you are not performing any actions or calling any methods.
All you are doing with this message expectation is saying that for this test to pass, the message_board should receive a call of slow_down!
The normal flow here would be to then execute some code to see if it happened.
it "should receive slow down from conductor" do
message_board.should_receive(:slow_down!)
conductor.see_danger_coming!
end
You could specify the exact argument you want. For example, if you wanted to make sure the AnswerBank received the answer 42, you could: answer_bank.should_receive(:record_answer).with(42) By default, it will accept "any_arguments" if you do not specifiy. |
it "should receive a slow down confirmation from the engineer" do | ||
message_board.should_receive(:confirm_slow_down!) | ||
engineer.should(:slow_down!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a valid specification?
It COULD be, if you write it. That is, if you created a customer matcher... But you didn't, so you got an error about a "matcher"
Hmmm. Okay, how do my tests look? Am I on the right track? |
Yep, you're on the right track! |
Sorry I am dong so many at one time but wanted to go over some core concepts before I got started with my MVP. I'm looking into "any args" and am only getting more confused. Do you suggest any resources or am I over-thinking this? |
IMHO you are way over-thinking this. But, if you want to see the documentation: https://www.relishapp.com/rspec/rspec-mocks/docs/message-expectations/expect-message-using-should-receive#expect-a-message-with-an-argument |
Hmm. How am I over-thinking this? |
because any_args simply doesn't matter On Mon, Feb 17, 2014 at 10:55 PM, Mike Adeleke [email protected]
|
I'm wondering in RSpec if the previous tests pass before you move on to next test. That way, I can see that since Engineer and Conductor have already had their actions I do not need them again in MessageBoard. But then, I seem to get the wrong number of arguementts and don't exactly know what I should be passing in.