Given a user "Aslak" exists # features/step_definitions/login_steps.rb:1 When he logs in # features/step_definitions/login_steps.rb:4 undefined method `[]' for nil:NilClass (NoMethodError) ./features/step_definitions/login_steps.rb:5:in `/^he logs in$/' features/login.feature:5:in `When he logs in'
Is this because I use @user.name or do I don't see the right reason ?
The comment in snippets is there for a reason (pending # express the regexp
above with the code you wish you had)
Instead of leaving the Given stepdef blank you should have written some
code here. Since you didn't you got confused at a later stage - in the When
step.
> Given a user "Aslak" exists #
> features/step_definitions/login_steps.rb:1
> When he logs in #
> features/step_definitions/login_steps.rb:4
> undefined method `[]' for nil:NilClass (NoMethodError)
> ./features/step_definitions/login_steps.rb:5:in `/^he logs in$/'
> features/login.feature:5:in `When he logs in'
> Is this because I use @user.name or do I don't see the right reason ?
> Roelof
> --
> -- Rules --
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style > 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes@googlegroups.com.
> To unsubscribe from this group, send email to
> cukes+unsubscribe@googlegroups.com. For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
One thing I don't understand. Why create a new user ?
In my opinion a existing user is a user which is already in the database and in the user model so a existing user is already created.
Roelof
Op vrijdag 2 november 2012 18:20:18 UTC+1 schreef Aslak Hellesøy het volgende:
> The comment in snippets is there for a reason (pending # express the > regexp above with the code you wish you had)
> Instead of leaving the Given stepdef blank you should have written some > code here. Since you didn't you got confused at a later stage - in the When > step.
>> Given a user "Aslak" exists # >> features/step_definitions/login_steps.rb:1
>> When he logs in # >> features/step_definitions/login_steps.rb:4
>> undefined method `[]' for nil:NilClass (NoMethodError)
>> ./features/step_definitions/login_steps.rb:5:in `/^he logs in$/'
>> features/login.feature:5:in `When he logs in'
>> Is this because I use @user.name or do I don't see the right reason ?
>> Roelof
>> -- >> -- Rules --
>> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
>> 2) Please use interleaved answers >> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style >> 3) If you have a question, don't reply to an existing message. Start a >> new topic instead.
>> You received this message because you are subscribed to the Google Groups >> Cukes group. To post to this group, send email to cu...@googlegroups.com<javascript:>. >> To unsubscribe from this group, send email to >> cukes+un...@googlegroups.com <javascript:>. For more options, visit this >> group at https://groups.google.com/d/forum/cukes?hl=en
> One thing I don't understand. Why create a new user ?
> In my opinion a existing user is a user which is already in the database
> and in the user model so a existing user is already created.
You have never initialized the @user variable. Since it's nil, you can't call any methods on it.
> The comment in snippets is there for a reason (pending# express the
> regexp above with the code you wish you had)
> Instead of leaving the Given stepdef blank you should have written
> some code here. Since you didn't you got confused at a later stage -
> in the When step.
> Given a user "Aslak" exists #
> features/step_definitions/login_steps.rb:1
> When he logs in #
> features/step_definitions/login_steps.rb:4
> undefined method `[]' for nil:NilClass (NoMethodError)
> ./features/step_definitions/login_steps.rb:5:in `/^he
> logs in$/'
> features/login.feature:5:in `When he logs in'
> Is this because I use @user.name <http://user.name> or do I
> don't see the right reason ?
Scenario: log in as existing user # features/login.feature:3
Given a user "Aslak" exists # features/step_definitions/login_steps.rb:5
unknown attribute: name (ActiveRecord::UnknownAttributeError)
./features/step_definitions/login_steps.rb:6:in `/^a user "(.*?)" exists$/'
features/login.feature:4:in `Given a user "Aslak" exists'
Must I now write my spec files or must I change something in my step-defenitions to solve this problem.
Roelof
Op vrijdag 2 november 2012 20:21:58 UTC+1 schreef George Dinwiddie het volgende:
> On 11/2/12 2:30 PM, roelof wrote: > > One thing I don't understand. Why create a new user ? > > In my opinion a existing user is a user which is already in the database > > and in the user model so a existing user is already created.
> You have never initialized the @user variable. Since it's nil, you can't > call any methods on it.
> > The comment in snippets is there for a reason (pending# express the > > regexp above with the code you wish you had)
> > Instead of leaving the Given stepdef blank you should have written > > some code here. Since you didn't you got confused at a later stage - > > in the When step.
> > Given a user "Aslak" exists # > > features/step_definitions/login_steps.rb:1 > > When he logs in # > > features/step_definitions/login_steps.rb:4 > > undefined method `[]' for nil:NilClass (NoMethodError) > > ./features/step_definitions/login_steps.rb:5:in `/^he > > logs in$/' > > features/login.feature:5:in `When he logs in'
> > Is this because I use @user.name <http://user.name> or do I > > don't see the right reason ?
I solved this one with chancing the class definition to this :
class User < ActiveRecord::Base
attr_accessible :name, :password
def initialize @name = name
@password = password
end
end
But now I see this message:
Given a user "Aslak" exists # features/step_definitions/login_steps.rb:10
wrong number of arguments (2 for 0) (ArgumentError)
./features/step_definitions/login_steps.rb:4:in `initialize'
./features/step_definitions/login_steps.rb:11:in `/^a user "(.*?)" exists$/'
features/login.feature:4:in `Given a user "Aslak" exists'
Roelof
Op zaterdag 3 november 2012 09:09:27 UTC+1 schreef roelof het volgende:
> Scenario: log in as existing user # features/login.feature:3
> Given a user "Aslak" exists # > features/step_definitions/login_steps.rb:5
> unknown attribute: name (ActiveRecord::UnknownAttributeError)
> ./features/step_definitions/login_steps.rb:6:in `/^a user "(.*?)" > exists$/'
> features/login.feature:4:in `Given a user "Aslak" exists'
> Must I now write my spec files or must I change something in my > step-defenitions to solve this problem.
> Roelof
> Op vrijdag 2 november 2012 20:21:58 UTC+1 schreef George Dinwiddie het > volgende:
>> Roelof,
>> On 11/2/12 2:30 PM, roelof wrote: >> > One thing I don't understand. Why create a new user ? >> > In my opinion a existing user is a user which is already in the >> database >> > and in the user model so a existing user is already created.
>> You have never initialized the @user variable. Since it's nil, you can't >> call any methods on it.
>> > The comment in snippets is there for a reason (pending# express the >> > regexp above with the code you wish you had)
>> > Instead of leaving the Given stepdef blank you should have written >> > some code here. Since you didn't you got confused at a later stage >> - >> > in the When step.
>> > Given a user "Aslak" exists # >> > features/step_definitions/login_steps.rb:1 >> > When he logs in # >> > features/step_definitions/login_steps.rb:4 >> > undefined method `[]' for nil:NilClass (NoMethodError) >> > ./features/step_definitions/login_steps.rb:5:in `/^he >> > logs in$/' >> > features/login.feature:5:in `When he logs in'
>> > Is this because I use @user.name <http://user.name> or do I >> > don't see the right reason ?
> I solved this one with chancing the class definition to this :
> class User < ActiveRecord::Base
> attr_accessible :name, :password
> def initialize > @name = name
> @password = password
> end
> end
> But now I see this message:
> Given a user "Aslak" exists # features/step_definitions/login_steps.rb:10
> wrong number of arguments (2 for 0) (ArgumentError)
> ./features/step_definitions/login_steps.rb:4:in `initialize'
> ./features/step_definitions/login_steps.rb:11:in `/^a user "(.*?)" exists$/'
> features/login.feature:4:in `Given a user "Aslak" exists'
> Roelof
How your step def looks like?
You are trying to reach a record with 2 arguments where you dont need any.
> Op zaterdag 3 november 2012 09:09:27 UTC+1 schreef roelof het volgende:
>> Thanks,
>> I now get this message:
>> Scenario: log in as existing user # features/login.feature:3
>> Given a user "Aslak" exists # features/step_definitions/login_steps.rb:5
>> unknown attribute: name (ActiveRecord::UnknownAttributeError)
>> ./features/step_definitions/login_steps.rb:6:in `/^a user "(.*?)" exists$/'
>> features/login.feature:4:in `Given a user "Aslak" exists'
>> Must I now write my spec files or must I change something in my step-defenitions to solve this problem.
>> Roelof
>> Op vrijdag 2 november 2012 20:21:58 UTC+1 schreef George Dinwiddie het volgende:
>>> Roelof,
>>> On 11/2/12 2:30 PM, roelof wrote: >>> > One thing I don't understand. Why create a new user ? >>> > In my opinion a existing user is a user which is already in the database >>> > and in the user model so a existing user is already created.
>>> You have never initialized the @user variable. Since it's nil, you can't >>> call any methods on it.
>>> > The comment in snippets is there for a reason (pending# express the >>> > regexp above with the code you wish you had)
>>> > Instead of leaving the Given stepdef blank you should have written >>> > some code here. Since you didn't you got confused at a later stage - >>> > in the When step.
>>> > Given a user "Aslak" exists # >>> > features/step_definitions/login_steps.rb:1 >>> > When he logs in # >>> > features/step_definitions/login_steps.rb:4 >>> > undefined method `[]' for nil:NilClass (NoMethodError) >>> > ./features/step_definitions/login_steps.rb:5:in `/^he >>> > logs in$/' >>> > features/login.feature:5:in `When he logs in'
>>> > Is this because I use @user.name <http://user.name> or do I >>> > don't see the right reason ?
>>> > Roelof
>>> -- >>> ---------------------------------------------------------------------- >>> * George Dinwiddie * http://blog.gdinwiddie.com >>> Software Development http://www.idiacomputing.com >>> Consultant and Coach http://www.agilemaryland.org >>> ----------------------------------------------------------------------
> -- > -- Rules --
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style > 3) If you have a question, don't reply to an existing message. Start a new topic instead.
> You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes@googlegroups.com. To unsubscribe from this group, send email to cukes+unsubscribe@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Hello, My steps definition looks like this : Subject: Re: [Cucumber] Am I on the right track
From: vice...@gmail.com
Date: Sat, 3 Nov 2012 09:05:28 -0200
To: cukes@googlegroups.com
Vicenzo Naves
Sent from my iPhone+55 (31)9996-6915
On 03/11/2012, at 07:07, roelof <rwob...@hotmail.com> wrote:
I solved this one with chancing the class definition to this :
class User < ActiveRecord::Base
attr_accessible :name, :password
def initialize @name = name
@password = password
end
end
But now I see this message:
Given a user "Aslak" exists # features/step_definitions/login_steps.rb:10
wrong number of arguments (2 for 0) (ArgumentError)
./features/step_definitions/login_steps.rb:4:in `initialize'
./features/step_definitions/login_steps.rb:11:in `/^a user "(.*?)" exists$/'
features/login.feature:4:in `Given a user "Aslak" exists'
Roelof
How your step def looks like?You are trying to reach a record with 2 arguments where you dont need any. It's look like this : class User < ActiveRecord::Base attr_accessible :name, :password def initialize @name = name @password = password end end
Given /^a user "(.*?)" exists$/ do |user_name| @user = User.create!(:name => user_name, :password => "s3cr3t")end
When /^he logs in$/ do visit("/users/sign_in") fill_in('User name', :with => @user.name) fill_in('Password', :with => @user.password) click_button('Log in')end
Then /^he should see "(.*?)"$/ do pending # express the regexp above with the code you wish you hadend
When /^he logs in with a bad password$/ do pending # express the regexp above with the code you wish you hadend
Then /^he should not see "(.*?)"$/ do |arg1| pending # express the regexp above with the code you wish you hadend Roelof
Op zaterdag 3 november 2012 09:09:27 UTC+1 schreef roelof het volgende:Thanks,
I now get this message:
Scenario: log in as existing user # features/login.feature:3
Given a user "Aslak" exists # features/step_definitions/login_steps.rb:5
unknown attribute: name (ActiveRecord::UnknownAttributeError)
./features/step_definitions/login_steps.rb:6:in `/^a user "(.*?)" exists$/'
features/login.feature:4:in `Given a user "Aslak" exists'
Must I now write my spec files or must I change something in my step-defenitions to solve this problem.
Roelof
Op vrijdag 2 november 2012 20:21:58 UTC+1 schreef George Dinwiddie het volgende:Roelof,
On 11/2/12 2:30 PM, roelof wrote:
> One thing I don't understand. Why create a new user ?
> In my opinion a existing user is a user which is already in the database
> and in the user model so a existing user is already created.
You have never initialized the @user variable. Since it's nil, you can't
> The comment in snippets is there for a reason (pending# express the
> regexp above with the code you wish you had)
> Instead of leaving the Given stepdef blank you should have written
> some code here. Since you didn't you got confused at a later stage -
> in the When step.
> Given a user "Aslak" exists #
> features/step_definitions/login_steps.rb:1
> When he logs in #
> features/step_definitions/login_steps.rb:4
> undefined method `[]' for nil:NilClass (NoMethodError)
> ./features/step_definitions/login_steps.rb:5:in `/^he
> logs in$/'
> features/login.feature:5:in `When he logs in'
> Is this because I use @user.name <http://user.name> or do I
> don't see the right reason ?
3) If you have a question, don't reply to an existing message. Start a new topic instead.
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes@googlegroups.com. To unsubscribe from this group, send email to cukes+unsubscribe@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
--
-- Rules --
1) Please prefix the subject with [Ruby], [JVM] or [JS].
3) If you have a question, don't reply to an existing message. Start a new topic instead.
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes@googlegroups.com. To unsubscribe from this group, send email to cukes+unsubscribe@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
On Sat, Nov 3, 2012 at 9:24 AM, Roelof Wobben <rwob...@hotmail.com> wrote:
> Hello,
> My steps definition looks like this :
> ------------------------------
> Subject: Re: [Cucumber] Am I on the right track
> From: vice...@gmail.com
> Date: Sat, 3 Nov 2012 09:05:28 -0200
> To: cukes@googlegroups.com
> Vicenzo Naves
> Sent from my iPhone
> +55 (31)9996-6915
> On 03/11/2012, at 07:07, roelof <rwob...@hotmail.com> wrote:
> I solved this one with chancing the class definition to this :
> class User < ActiveRecord::Base
> attr_accessible :name, :password
> def initialize
> @name = name
> @password = password
> end
> end
> But now I see this message:
> Given a user "Aslak" exists #
> features/step_definitions/login_steps.rb:10
> wrong number of arguments (2 for 0) (ArgumentError)
> ./features/step_definitions/login_steps.rb:4:in `initialize'
> ./features/step_definitions/login_steps.rb:11:in `/^a user "(.*?)"
> exists$/'
> features/login.feature:4:in `Given a user "Aslak" exists'
> Roelof
> How your step def looks like?
> You are trying to reach a record with 2 arguments where you dont need any.
> It's look like this :
> class User < ActiveRecord::Base
> attr_accessible :name, :password
> def initialize
> @name = name
> @password = password
> end
> end
> Given /^a user "(.*?)" exists$/ do |user_name|
> @user = User.create!(:name => user_name, :password => "s3cr3t")
> end
> When /^he logs in$/ do
> visit("/users/sign_in")
> fill_in('User name', :with => @user.name)
> fill_in('Password', :with => @user.password)
> click_button('Log in')
> end
> Then /^he should see "(.*?)"$/ do
> pending # express the regexp above with the code you wish you had
> end
> When /^he logs in with a bad password$/ do
> pending # express the regexp above with the code you wish you had
> end
> Then /^he should not see "(.*?)"$/ do |arg1|
> pending # express the regexp above with the code you wish you had
> end
> Roelof
> Op zaterdag 3 november 2012 09:09:27 UTC+1 schreef roelof het volgende:
> Thanks,
> I now get this message:
> Scenario: log in as existing user # features/login.feature:3
> Given a user "Aslak" exists # features/step_definitions/**
> login_steps.rb:5
> unknown attribute: name (ActiveRecord::**UnknownAttributeError)
> ./features/step_definitions/**login_steps.rb:6:in `/^a user "(.*?)"
> exists$/'
> features/login.feature:4:in `Given a user "Aslak" exists'
> Must I now write my spec files or must I change something in my
> step-defenitions to solve this problem.
> Roelof
> Op vrijdag 2 november 2012 20:21:58 UTC+1 schreef George Dinwiddie het
> volgende:
> Roelof,
> On 11/2/12 2:30 PM, roelof wrote:
> > One thing I don't understand. Why create a new user ?
> > In my opinion a existing user is a user which is already in the database
> > and in the user model so a existing user is already created.
> You have never initialized the @user variable. Since it's nil, you can't
> call any methods on it.
> > The comment in snippets is there for a reason (pending# express the
> > regexp above with the code you wish you had)
> > Instead of leaving the Given stepdef blank you should have written
> > some code here. Since you didn't you got confused at a later stage -
> > in the When step.
> > Given a user "Aslak" exists #
> > features/step_definitions/**login_steps.rb:1
> > When he logs in #
> > features/step_definitions/**login_steps.rb:4
> > undefined method `[]' for nil:NilClass (NoMethodError)
> > ./features/step_definitions/**login_steps.rb:5:in `/^he
> > logs in$/'
> > features/login.feature:5:in `When he logs in'
> > Is this because I use @user.name <http://user.name> or do I
> > don't see the right reason ?
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style > 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes@googlegroups.com.
> To unsubscribe from this group, send email to
> cukes+unsubscribe@googlegroups.com. For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
> --
> -- Rules --
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style > 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes@googlegroups.com.
> To unsubscribe from this group, send email to
> cukes+unsubscribe@googlegroups.com. For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
> --
> -- Rules --
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style > 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes@googlegroups.com.
> To unsubscribe from this group, send email to
> cukes+unsubscribe@googlegroups.com. For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
-- Vicenzo Naves
ISTQB CTFL Certified
Analista de Testes
(31) 9996-6915
www.geekcuisine.com.br
On Sat, Nov 3, 2012 at 9:07 AM, roelof <rwob...@hotmail.com> wrote:
> I solved this one with chancing the class definition to this :
> class User < ActiveRecord::Base
> attr_accessible :name, :password
> def initialize
> @name = name
> @password = password
> end
> end
May I suggest you study Ruby on Rails before you continue any further? This
is not how you create attributes on an activerecord class. It's done by
adding columns to its table. You have to add a migration.
It seems like you're new to more than just Cucumber, and that makes it a
little tricky to use a forum like this. We want to stay focussed on
Cucumber here.
> Given a user "Aslak" exists #
> features/step_definitions/login_steps.rb:10
> wrong number of arguments (2 for 0) (ArgumentError)
> ./features/step_definitions/login_steps.rb:4:in `initialize'
> ./features/step_definitions/login_steps.rb:11:in `/^a user "(.*?)"
> exists$/'
> features/login.feature:4:in `Given a user "Aslak" exists'
> Roelof
> Op zaterdag 3 november 2012 09:09:27 UTC+1 schreef roelof het volgende:
>> Thanks,
>> I now get this message:
>> Scenario: log in as existing user # features/login.feature:3
>> Given a user "Aslak" exists # features/step_definitions/**
>> login_steps.rb:5
>> unknown attribute: name (ActiveRecord::**UnknownAttributeError)
>> ./features/step_definitions/**login_steps.rb:6:in `/^a user
>> "(.*?)" exists$/'
>> features/login.feature:4:in `Given a user "Aslak" exists'
>> Must I now write my spec files or must I change something in my
>> step-defenitions to solve this problem.
>> Roelof
>> Op vrijdag 2 november 2012 20:21:58 UTC+1 schreef George Dinwiddie het
>> volgende:
>>> Roelof,
>>> On 11/2/12 2:30 PM, roelof wrote:
>>> > One thing I don't understand. Why create a new user ?
>>> > In my opinion a existing user is a user which is already in the
>>> database
>>> > and in the user model so a existing user is already created.
>>> You have never initialized the @user variable. Since it's nil, you can't
>>> call any methods on it.
>>> > The comment in snippets is there for a reason (pending# express
>>> the
>>> > regexp above with the code you wish you had)
>>> > Instead of leaving the Given stepdef blank you should have written
>>> > some code here. Since you didn't you got confused at a later stage
>>> -
>>> > in the When step.
>>> > Given a user "Aslak" exists #
>>> > features/step_definitions/**login_steps.rb:1
>>> > When he logs in #
>>> > features/step_definitions/**login_steps.rb:4
>>> > undefined method `[]' for nil:NilClass (NoMethodError)
>>> > ./features/step_definitions/**login_steps.rb:5:in
>>> `/^he
>>> > logs in$/'
>>> > features/login.feature:5:in `When he logs in'
>>> > Is this because I use @user.name <http://user.name> or do I
>>> > don't see the right reason ?
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style > 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes@googlegroups.com.
> To unsubscribe from this group, send email to
> cukes+unsubscribe@googlegroups.com. For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
Your right.
Im new to Cucumber and Ruby. I tought I had learned Ruby from codeschool but appearently I don know enough
I was just asking about a new problem but maybe I can better ask on the Ruby Forum,
I now see these messages :
When he logs in # features/step_definitions/login_steps.rb:5
undefined method `[]' for nil:NilClass (NoMethodError)
./features/step_definitions/login_steps.rb:6:in `/^he logs in$/'
features/login.feature:5:in `When he logs in'
I changed the scenario because the devise gem is using a email adress instead of a name.
But appearently I missed something. II wonder if this is too hard material to learn without a teacher and learn this from a book myself.
Roelof
Op zaterdag 3 november 2012 12:39:28 UTC+1 schreef Aslak Hellesøy het volgende:
> On Sat, Nov 3, 2012 at 9:07 AM, roelof <rwo...@hotmail.com <javascript:>>wrote:
>> I solved this one with chancing the class definition to this :
>> class User < ActiveRecord::Base
>> attr_accessible :name, :password
>> def initialize >> @name = name
>> @password = password
>> end
>> end
> May I suggest you study Ruby on Rails before you continue any further? > This is not how you create attributes on an activerecord class. It's done > by adding columns to its table. You have to add a migration.
> It seems like you're new to more than just Cucumber, and that makes it a > little tricky to use a forum like this. We want to stay focussed on > Cucumber here.
> Aslak
> But now I see this message:
>> Given a user "Aslak" exists # >> features/step_definitions/login_steps.rb:10
>> wrong number of arguments (2 for 0) (ArgumentError)
>> ./features/step_definitions/login_steps.rb:4:in `initialize'
>> ./features/step_definitions/login_steps.rb:11:in `/^a user "(.*?)" >> exists$/'
>> features/login.feature:4:in `Given a user "Aslak" exists'
>> Roelof
>> Op zaterdag 3 november 2012 09:09:27 UTC+1 schreef roelof het volgende:
>>> Thanks,
>>> I now get this message:
>>> Scenario: log in as existing user # features/login.feature:3
>>> Given a user "Aslak" exists # features/step_definitions/**
>>> login_steps.rb:5
>>> unknown attribute: name (ActiveRecord::**UnknownAttributeError)
>>> ./features/step_definitions/**login_steps.rb:6:in `/^a user >>> "(.*?)" exists$/'
>>> features/login.feature:4:in `Given a user "Aslak" exists'
>>> Must I now write my spec files or must I change something in my >>> step-defenitions to solve this problem.
>>> Roelof
>>> Op vrijdag 2 november 2012 20:21:58 UTC+1 schreef George Dinwiddie het >>> volgende:
>>>> Roelof,
>>>> On 11/2/12 2:30 PM, roelof wrote: >>>> > One thing I don't understand. Why create a new user ? >>>> > In my opinion a existing user is a user which is already in the >>>> database >>>> > and in the user model so a existing user is already created.
>>>> You have never initialized the @user variable. Since it's nil, you >>>> can't >>>> call any methods on it.
>>>> > The comment in snippets is there for a reason (pending# express >>>> the >>>> > regexp above with the code you wish you had)
>>>> > Instead of leaving the Given stepdef blank you should have >>>> written >>>> > some code here. Since you didn't you got confused at a later >>>> stage - >>>> > in the When step.
>>>> > Given a user "Aslak" exists # >>>> > features/step_definitions/**login_steps.rb:1 >>>> > When he logs in # >>>> > features/step_definitions/**login_steps.rb:4 >>>> > undefined method `[]' for nil:NilClass (NoMethodError) >>>> > ./features/step_definitions/**login_steps.rb:5:in >>>> `/^he >>>> > logs in$/' >>>> > features/login.feature:5:in `When he logs in'
>>>> > Is this because I use @user.name <http://user.name> or do I >>>> > don't see the right reason ?
>> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
>> 2) Please use interleaved answers >> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style >> 3) If you have a question, don't reply to an existing message. Start a >> new topic instead.
>> You received this message because you are subscribed to the Google Groups >> Cukes group. To post to this group, send email to cu...@googlegroups.com<javascript:>. >> To unsubscribe from this group, send email to >> cukes+un...@googlegroups.com <javascript:>. For more options, visit this >> group at https://groups.google.com/d/forum/cukes?hl=en
On Sat, Nov 3, 2012 at 12:57 PM, roelof <rwob...@hotmail.com> wrote:
> Your right.
> Im new to Cucumber and Ruby. I tought I had learned Ruby from codeschool
> but appearently I don know enough
Ruby (the programming language) is not the same as Ruby on Rails (the web
framework written in Ruby).
> I changed the scenario because the devise gem is using a email adress
> instead of a name.
> But appearently I missed something.
> II wonder if this is too hard material to learn without a teacher and
> learn this from a book myself.
Rails is a pretty big framework and I'd definitely pick up a book teaching
it. Some Rails books might try to teach you Ruby as well, but it might be
useful to pick up a (non-Rails) Ruby book as well.
> Op zaterdag 3 november 2012 12:39:28 UTC+1 schreef Aslak Hellesøy het
> volgende:
>> On Sat, Nov 3, 2012 at 9:07 AM, roelof <rwo...@hotmail.com> wrote:
>>> I solved this one with chancing the class definition to this :
>>> class User < ActiveRecord::Base
>>> attr_accessible :name, :password
>>> def initialize
>>> @name = name
>>> @password = password
>>> end
>>> end
>> May I suggest you study Ruby on Rails before you continue any further?
>> This is not how you create attributes on an activerecord class. It's done
>> by adding columns to its table. You have to add a migration.
>> It seems like you're new to more than just Cucumber, and that makes it a
>> little tricky to use a forum like this. We want to stay focussed on
>> Cucumber here.
>> Aslak
>> But now I see this message:
>>> Given a user "Aslak" exists # features/step_definitions/**
>>> login_steps.rb:10
>>> wrong number of arguments (2 for 0) (ArgumentError)
>>> ./features/step_definitions/**login_steps.rb:4:in `initialize'
>>> ./features/step_definitions/**login_steps.rb:11:in `/^a user
>>> "(.*?)" exists$/'
>>> features/login.feature:4:in `Given a user "Aslak" exists'
>>> Roelof
>>> Op zaterdag 3 november 2012 09:09:27 UTC+1 schreef roelof het volgende:
>>>> Thanks,
>>>> I now get this message:
>>>> Scenario: log in as existing user # features/login.feature:3
>>>> Given a user "Aslak" exists # features/step_definitions/**
>>>> logi**n_steps.rb:5
>>>> unknown attribute: name (ActiveRecord::**UnknownAttribut**eError)
>>>> ./features/step_definitions/**lo**gin_steps.rb:6:in `/^a user
>>>> "(.*?)" exists$/'
>>>> features/login.feature:4:in `Given a user "Aslak" exists'
>>>> Must I now write my spec files or must I change something in my
>>>> step-defenitions to solve this problem.
>>>> Roelof
>>>> Op vrijdag 2 november 2012 20:21:58 UTC+1 schreef George Dinwiddie het
>>>> volgende:
>>>>> Roelof,
>>>>> On 11/2/12 2:30 PM, roelof wrote:
>>>>> > One thing I don't understand. Why create a new user ?
>>>>> > In my opinion a existing user is a user which is already in the
>>>>> database
>>>>> > and in the user model so a existing user is already created.
>>>>> You have never initialized the @user variable. Since it's nil, you
>>>>> can't
>>>>> call any methods on it.
>>>>> > The comment in snippets is there for a reason (pending# express
>>>>> the
>>>>> > regexp above with the code you wish you had)
>>>>> > Instead of leaving the Given stepdef blank you should have
>>>>> written
>>>>> > some code here. Since you didn't you got confused at a later
>>>>> stage -
>>>>> > in the When step.
>>>>> > Given a user "Aslak" exists #
>>>>> > features/step_definitions/**logi**n_steps.rb:1
>>>>> > When he logs in #
>>>>> > features/step_definitions/**logi**n_steps.rb:4
>>>>> > undefined method `[]' for nil:NilClass
>>>>> (NoMethodError)
>>>>> > ./features/step_definitions/**l**ogin_steps.rb:5:in
>>>>> `/^he
>>>>> > logs in$/'
>>>>> > features/login.feature:5:in `When he logs in'
>>>>> > Is this because I use @user.name <http://user.name> or do I
>>>>> > don't see the right reason ?
>>> You received this message because you are subscribed to the Google
>>> Groups Cukes group. To post to this group, send email to
>>> cu...@googlegroups.com. To unsubscribe from this group, send email to
>>> cukes+un...@**googlegroups.com. For more options, visit this group at
>>> https://groups.google.com/d/**forum/cukes?hl=en<https://groups.google.com/d/forum/cukes?hl=en>
>> --
> -- Rules --
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
> http://en.wikipedia.org/wiki/Posting_style#Interleaved_style > 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to cukes@googlegroups.com.
> To unsubscribe from this group, send email to
> cukes+unsubscribe@googlegroups.com. For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en
> I making my first BDD site which you can find here : > https://github.com/roelof1967/tamara > Now the first test is failing with this message :
> Given a user "Aslak" exists # > features/step_definitions/login_steps.rb:1 > When he logs in # > features/step_definitions/login_steps.rb:4 > undefined method `[]' for nil:NilClass (NoMethodError) > ./features/step_definitions/login_steps.rb:5:in `/^he logs in$/' > features/login.feature:5:in `When he logs in'
> Is this because I use @user.name or do I don't see the right reason ?