When I do cucumber I get this error message :
Then he should see “Welcome, Aslak” #
features/step_definitions/login_steps.rb:27
undefined method messages' for nil:NilClass (NoMethodError) ./features/step_definitions/login_steps.rb:28:in /^he should see
“(.*?)”$/’
features/login.feature:6:in `Then he should see “Welcome, Aslak”’
Which I find wierd because I have a method messages made in my class
Output.
features/login.feature:6:in `Then he should see "Welcome, Aslak"'
Which I find wierd because I have a method messages made in my class Output.
You have the messages method, but the error is saying that the object
you are calling it on is nil. So on the line that is calling
something.messages then the something is nil. You have to work out
why it is nil.
The only thing I can think of is that output is not created.
But that cannot be the reason because there is a function create which
contains Ouput.new which is the same as Output.create.
Roelof
Op zaterdag 3 november 2012 21:59:16 UTC+1 schreef Colin L. het
volgende:
Then /^he should see “(.*?)”$/ do |message| @output.messages.should include (message)
end
I have no idea what you are saying now. Is this a different problem?
If so then again post the error message and the relevant code. Just
put the code inline here unless it is long, it is easier to comment
here than if you have put it somewhere else. You only need to post
the relevant 10 or 20 lines.
Op zondag 4 november 2012 18:52:46 UTC+1 schreef Colin L. het volgende:
end
I have no idea what you are saying now. Is this a different problem?
If so then again post the error message and the relevant code. Just
put the code inline here unless it is long, it is easier to comment
here than if you have put it somewhere else. You only need to post
the relevant 10 or 20 lines.
Colin
No I try to answer where message is coming from.
Message is as I understand from the step-definition and should include
the
text “Welcome asLak”
No I try to answer where message is coming from.
Message is as I understand from the step-definition and should include the
text “Welcome asLak”
Sorry, you still have not explained the problem. Explain what is
happening, what should be happening, and show us the code that should
do what you expect. Without that information we can do nothing.
You are still sending a copy to me by the way, which is undesirable.
Given a user “[email protected]” exists
def puts(message)
messages << message
It is difficult to help if you don’t read and try to understand the
attempts to help you. As I have said before you have not initialised
the local variable messages. You have initialised the class instance
variable @messages, but that is not the same variable.
In addition I have asked twice if not three times that you do not send
me personally a copy of your emails. Just send it to the list please,
I do not need two copies.
On Monday, 5 November 2012 01:40:06 UTC-5, roelof wrote:
This method doesn’t make any sense - you need to create an Output
instance
to call it on, then it creates an Output instance. I’d suggest you
review a
good Ruby reference to sort out your understanding of how objects work.
More to the point, what is the Output class supposed to DO? Your
cucumber
step seemed to be expecting that messages would be sent to an Output
object, but I don’t see any indication of how that was supposed to
happen…
–Matt J.
–Matt J.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.