Hello, I have my source here : https://github.com/roelof1967/tamara 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. Roelof -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/kwWlq8vMthoJ. For more options, visit https://groups.google.com/groups/opt_out.
On 3 November 2012 20:43, roelof <rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> Hello, > > I have my source here : https://github.com/roelof1967/tamara > > 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.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. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
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 Law het volgende:> On 3 November 2012 20:43, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org <javascript:>> > wrote: > > Hello, > > > > I have my source here : https://github.com/roelof1967/tamara > > > > 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. > > 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. > > Colin >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/wJzgQSszf4AJ. For more options, visit https://groups.google.com/groups/opt_out.
On 4 November 2012 12:03, Roelof Wobben <rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> > >> From: clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org >> Date: Sun, 4 Nov 2012 09:23:09 +0000 >> Subject: Re: [Rails] Wierd NomethodError >> To: rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > >> >> On 4 November 2012 08:08, roelof <rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: >> >> Please don''t top post, it makes it difficult to follow the thread. >> Insert your replies at appropriate points in previous message. >> Thanks. >> >> > 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. >> >> It might help if you were to show us the bit of code generating the >> error. We are not telepathic. At least I am not. Look carefully at >> the error message to find the relevant code. > > > The error message can be found here : https://gist.github.com/4008123 > And the relevant code can be found here : > https://github.com/roelof1967/tamara/blob/master/features/step_definitions/login_steps.rbThat is a different error message to the one you originally posted. What is the line messages << message supposed to do. What is the variable messages? Have a look at the Rails Guide on debugging, it will show you techniques that you can use to debug your code and work out what is going wrong. Colin> > > Roelof > > >> >> Colin >> >> > >> > Roelof >> > >> > >> > Op zaterdag 3 november 2012 21:59:16 UTC+1 schreef Colin Law het >> > volgende: >> >> >> >> On 3 November 2012 20:43, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: >> >> > Hello, >> >> > >> >> > I have my source here : https://github.com/roelof1967/tamara >> >> > >> >> > 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. >> >> >> >> 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. >> >> >> >> Colin-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Op zondag 4 november 2012 13:44:57 UTC+1 schreef Colin Law het volgende:> > On 4 November 2012 12:03, Roelof Wobben <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org <javascript:>> > wrote: > > > > > >> From: cla...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org <javascript:> > >> Date: Sun, 4 Nov 2012 09:23:09 +0000 > >> Subject: Re: [Rails] Wierd NomethodError > >> To: rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org <javascript:> > > > >> > >> On 4 November 2012 08:08, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org <javascript:>> > wrote: > >> > >> Please don''t top post, it makes it difficult to follow the thread. > >> Insert your replies at appropriate points in previous message. > >> Thanks. > >> > >> > 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. > >> > >> It might help if you were to show us the bit of code generating the > >> error. We are not telepathic. At least I am not. Look carefully at > >> the error message to find the relevant code. > > > > > > The error message can be found here : https://gist.github.com/4008123 > > And the relevant code can be found here : > > > https://github.com/roelof1967/tamara/blob/master/features/step_definitions/login_steps.rb > > That is a different error message to the one you originally posted. > > What is the line > messages << message > supposed to do. What is the variable messages? >The variable messages is a array containing the all the messages. The variable message does contain the message. I took this part of the Rspec book.> > Have a look at the Rails Guide on debugging, it will show you > techniques that you can use to debug your code and work out what is > going wrong. > >I will look into it and hope I can find a solution to this problem.> Roelof > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/AGX6YI9R4nAJ. For more options, visit https://groups.google.com/groups/opt_out.
On 4 November 2012 17:45, Roelof Wobben <rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> ... > Message come from here. > > Then he should see "Welcome, Aslak" > > Then /^he should see "(.*?)"$/ do |message| > @output.messages.should include (message) > endI 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 PS Just send it to the list, no need to copy me. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Op zondag 4 november 2012 18:52:46 UTC+1 schreef Colin Law het volgende:> > On 4 November 2012 17:45, Roelof Wobben <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org <javascript:>> > wrote: > > ... > > Message come from here. > > > > Then he should see "Welcome, Aslak" > > > > 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. > > 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" Roelof>-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/B8pDqDkar9oJ. For more options, visit https://groups.google.com/groups/opt_out.
On 4 November 2012 18:46, roelof <rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> > Op zondag 4 november 2012 18:52:46 UTC+1 schreef Colin Law het volgende: >> >> On 4 November 2012 17:45, Roelof Wobben <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: >> > ... >> > Message come from here. >> > >> > Then he should see "Welcome, Aslak" >> > >> > 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. >> >> 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"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. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Op zondag 4 november 2012 21:25:15 UTC+1 schreef Colin Law het volgende:> > On 4 November 2012 18:46, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org <javascript:>> > wrote: > > > > Op zondag 4 november 2012 18:52:46 UTC+1 schreef Colin Law het volgende: > >> > >> On 4 November 2012 17:45, Roelof Wobben <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: > >> > ... > >> > Message come from here. > >> > > >> > Then he should see "Welcome, Aslak" > >> > > >> > 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. > >> > >> 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" > > Sorry, you still have not explained the problem. Explain what is > happening,What happen is that I see the error message.> what should be happeningWhat schould be happen is that the message "Welcome Aslak" is being seen as the user Aslak is loggin in succesfull.> , and show us the code that should > do what you expect. >I will give you the cucumber code. Scenario: log in as existing user Given a user "Aslak-xilicTGVSIpLZa3bfcMRnA@public.gmane.org" exists When he logs in Then he should see "Welcome, Aslak" step-definition part : class Output def messages @messages ||= [] end def puts(message) messages << message end def output @output ||= Output.new end end Then /^he should see "(.*?)"$/ do |message| @output.messages.should include (message) end Roelof -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/hNTRYHMhxdkJ. For more options, visit https://groups.google.com/groups/opt_out.
On 4 November 2012 20:40, roelof <rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> > Op zondag 4 november 2012 21:25:15 UTC+1 schreef Colin Law het volgende: >> >> On 4 November 2012 18:46, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: >> > >> > Op zondag 4 november 2012 18:52:46 UTC+1 schreef Colin Law het volgende: >> >> >> >> On 4 November 2012 17:45, Roelof Wobben <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: >> >> > ... >> >> > Message come from here. >> >> > >> >> > Then he should see "Welcome, Aslak" >> >> > >> >> > 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. >> >> >> >> 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" >> >> Sorry, you still have not explained the problem. Explain what is >> happening, > > > What happen is that I see the error message. > >> >> what should be happening > > > What schould be happen is that the message "Welcome Aslak" is being seen as > the user Aslak is loggin in succesfull. > > >> >> , and show us the code that should >> do what you expect. > > > I will give you the cucumber code. > > > Scenario: log in as existing user > Given a user "Aslak-xilicTGVSIpLZa3bfcMRnA@public.gmane.org" exists > When he logs in > Then he should see "Welcome, Aslak" > > step-definition part : > > > class Output > def messages > @messages ||= [] > end > def puts(message) > messages << messageIt 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. Colin> end > def output > @output ||= Output.new > end > end > > Then /^he should see "(.*?)"$/ do |message| > @output.messages.should include (message) > end > > > Roelof >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Saturday, 3 November 2012 16:43:19 UTC-4, roelof wrote:> > Hello, > > I have my source here : https://github.com/roelof1967/tamara > > 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. > >I don''t see where you''re initializing @output anywhere in that file - it''s going to be hard to call methods on an uninitialized instance variable... --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/qwEhGpYKhJIJ. For more options, visit https://groups.google.com/groups/opt_out.
Hello, Im initializing that file here : def output @output ||= Output.new end in the class Output. Roelof Op maandag 5 november 2012 00:52:22 UTC+1 schreef Matt Jones het volgende:> > > On Saturday, 3 November 2012 16:43:19 UTC-4, roelof wrote: >> >> Hello, >> >> I have my source here : https://github.com/roelof1967/tamara >> >> 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. >> >> > I don''t see where you''re initializing @output anywhere in that file - it''s > going to be hard to call methods on an uninitialized instance variable... > > --Matt Jones >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/A0gcSBsTn0sJ. For more options, visit https://groups.google.com/groups/opt_out.
when you call @output.messages.should include (message) @output is nil call (@output ||= Output.new).messages.should include (message) On 05.11.2012, at 10:40, roelof <rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> Hello, > > Im initializing that file here : > > def output > @output ||= Output.new > end > > in the class Output. > > Roelof > > Op maandag 5 november 2012 00:52:22 UTC+1 schreef Matt Jones het volgende: > > > On Saturday, 3 November 2012 16:43:19 UTC-4, roelof wrote: > Hello, > > I have my source here : https://github.com/roelof1967/tamara > > 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. > > > I don''t see where you''re initializing @output anywhere in that file - it''s going to be hard to call methods on an uninitialized instance variable... > > --Matt Jones > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/A0gcSBsTn0sJ. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Op maandag 5 november 2012 15:34:05 UTC+1 schreef addagger het volgende:> > when you call @output.messages.should include (message) > @output is nil > > call (@output ||= Output.new).messages.should include (message) > > That worked but can you explain what this does ?Roelof> > > On 05.11.2012, at 10:40, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org <javascript:>> wrote: > > Hello, > > Im initializing that file here : > > def output > @output ||= Output.new > end > > in the class Output. > > Roelof > > Op maandag 5 november 2012 00:52:22 UTC+1 schreef Matt Jones het volgende: > >> >> >> On Saturday, 3 November 2012 16:43:19 UTC-4, roelof wrote: >>> >>> Hello, >>> >>> I have my source here : https://github.com/roelof1967/tamara >>> >>> 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. >>> >>> >> I don''t see where you''re initializing @output anywhere in that file - >> it''s going to be hard to call methods on an uninitialized instance >> variable... >> >> --Matt Jones >> > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<javascript:> > . > To unsubscribe from this group, send email to > rubyonrails-ta...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/A0gcSBsTn0sJ. > For more options, visit https://groups.google.com/groups/opt_out. > > > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/_OozA0jfEqIJ. For more options, visit https://groups.google.com/groups/opt_out.
get instance variable @output, and when its nil assigns an object Output.new On 05.11.2012, at 18:49, roelof <rwobben-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> > > Op maandag 5 november 2012 15:34:05 UTC+1 schreef addagger het volgende: > when you call @output.messages.should include (message) > @output is nil > > call (@output ||= Output.new).messages.should include (message) > > That worked but can you explain what this does ? > > Roelof > > > > On 05.11.2012, at 10:40, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: > >> Hello, >> >> Im initializing that file here : >> >> def output >> @output ||= Output.new >> end >> >> in the class Output. >> >> Roelof >> >> Op maandag 5 november 2012 00:52:22 UTC+1 schreef Matt Jones het volgende: >> >> >> On Saturday, 3 November 2012 16:43:19 UTC-4, roelof wrote: >> Hello, >> >> I have my source here : https://github.com/roelof1967/tamara >> >> 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. >> >> >> I don''t see where you''re initializing @output anywhere in that file - it''s going to be hard to call methods on an uninitialized instance variable... >> >> --Matt Jones >> >> -- >> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to rubyonrails-ta...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/A0gcSBsTn0sJ. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/_OozA0jfEqIJ. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Class for output should have been: class Output def messages @messages ||= [] end def puts(message) messages << message end end def output @output ||= Output.new end On Sunday, November 4, 2012 2:40:26 PM UTC-6, roelof wrote:> > > Op zondag 4 november 2012 21:25:15 UTC+1 schreef Colin Law het volgende: >> >> On 4 November 2012 18:46, roelof <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: >> > >> > Op zondag 4 november 2012 18:52:46 UTC+1 schreef Colin Law het >> volgende: >> >> >> >> On 4 November 2012 17:45, Roelof Wobben <rwo...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: >> >> > ... >> >> > Message come from here. >> >> > >> >> > Then he should see "Welcome, Aslak" >> >> > >> >> > 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. >> >> >> >> 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" >> >> Sorry, you still have not explained the problem. Explain what is >> happening, > > > What happen is that I see the error message. > > >> what should be happening > > > What schould be happen is that the message "Welcome Aslak" is being seen > as the user Aslak is loggin in succesfull. > > > >> , and show us the code that should >> do what you expect. >> > > I will give you the cucumber code. > > > Scenario: log in as existing user > Given a user "As...-xilicTGVSIpLZa3bfcMRnA@public.gmane.org <javascript:>" exists > When he logs in > Then he should see "Welcome, Aslak" > > step-definition part : > > > class Output > def messages > @messages ||= [] > end > def puts(message) > messages << message > end > def output > @output ||= Output.new > end > end > > Then /^he should see "(.*?)"$/ do |message| > @output.messages.should include (message) > end > > > Roelof > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/rYbSAPCPWUoJ. For more options, visit https://groups.google.com/groups/opt_out.
On Monday, 5 November 2012 01:40:06 UTC-5, roelof wrote:> > Hello, > > Im initializing that file here : > > def output > @output ||= Output.new > end > > in the class Output. > >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 Jones --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/O7WAuJTU7RkJ. For more options, visit https://groups.google.com/groups/opt_out.