Calling a step from a step


#1

cucumber 0.1.9

I have this:

When /obtain the party (.*)/ do |n|
n case
when “common name”
@party.entity_name = “Anything will do”
when “legal name”
@party.entity_legal_name = “Something a Bit Longer I SHOULD think”
when “corporate form”
@party.entity_legal_form = “PERS”
else
raise ArgumentError, “#{n} attribute is not provided for.”
end
end

When /should determine the party (.*) do |n|
When “obtain the party #{n}”
end

rake features gives this error:

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require’: ./features/step_definitions/entity_steps.rb:28:
unknown regexp options - rcrd (SyntaxError)
./features/step_definitions/entity_steps.rb:28: syntax error
Then /record the party/ do
^
./features/step_definitions/entity_steps.rb:28: syntax error

I understood that as of 0.1.7 cucumber supported steps from step calls.
Have I mistyped or misunderstood something


#2

James B. wrote:

When /should determine the party (.*) do |n|
When “obtain the party #{n}”
end

Missed the next follow on lines. Snippet should be:

When /should determine the party (.*) do |n|
When “obtain the party #{n}”
end

Then /record the party/ do
Entity.destroy_all
@party.save!
end


#3

James B. wrote:

James B. wrote:

When /should determine the party (.*) do |n|
When “obtain the party #{n}”
end

Another helpful tidbit that I neglected to post. The reason that I
focused on the step from step method shown above is that when I comment
these lines out the following method “Then /record the party/” run fine.


#4

Missing slash at end of regex

/When /should determine the party (.*)/

2008/11/24 James B. removed_email_address@domain.invalid:


#5

It looks like you are not closing your regexp here:

When /should determine the party (.*) do |n|
When “obtain the party #{n}”
end

So it doesn’t close until it gets here, where you are trying to start a
new
one:

Then /record the party/ do
Entity.destroy_all
@party.save!
end

And then is treating ‘record’ as options to the regexp and not
recognizing
some of them

rake features gives this error:

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require’: ./features/step_definitions/entity_steps.rb:28:
unknown regexp options - rcrd (SyntaxError)
./features/step_definitions/entity_steps.rb:28: syntax error Then /record
the party/ do
^
./features/step_definitions/entity_steps.rb:28: syntax error

__________ Information from ESET NOD32 Antivirus, version of virus
signature
database 3636 (20081124) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


#6

Nick H. wrote:

On 2008-11-24, at 11:16, James B. wrote:

I have this:

When /obtain the party (.*)/ do |n|
n case

Hi James. Shouldn’t that be “case n”?
-Nick

Yes.

Missing slash at end of regex

/When /should determine the party (.*)/

Sighhhh… Thanks.


#7

On 2008-11-24, at 11:16, James B. wrote:

I have this:

When /obtain the party (.*)/ do |n|
n case

Hi James. Shouldn’t that be “case n”?
-Nick


#8

On 2008-11-24, at 11:47, James B. wrote:

Missing slash at end of regex

/When /should determine the party (.*)/

Sighhhh… Thanks.

Hey, it happens to the best of us, mate. At least it’s an easy fix!