Discussion:
[Cucumber:2331] Re: cucumber placeholder names
(too old to reply)
aslak hellesoy
2009-11-14 20:52:32 UTC
Permalink
Aslak, in a step definition, is it possible for me to access the placeholder
name?
Given /^I type in "([^"]*)",$/ do |value|
    fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I want to fill in.
I don't think I understand the question. You want Cucumber to guess
what text field you're typing into?

Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally - I'm subscribed to the cukes list along with 500 other
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden
734-926-9614
skype: lsiden
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
Larry Siden
2009-11-14 20:44:03 UTC
Permalink
Aslak, in a step definition, is it possible for me to access the placeholder
name?

For example, in pseudo-code:

Given /^I type in "([^"]*)",$/ do |value|
fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I want to fill in.

Thank you,

Larry Siden
http://umich.edu/~lsiden
734-926-9614
skype: lsiden

--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
lsiden
2009-11-14 21:38:30 UTC
Permalink
The placeholder names are the same as the field names, so there is no
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps definitions.
Guess I'll get started now, and use your answer, if I can, another
time.
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access the placeholder
name?
Given /^I type in "([^"]*)",$/ do |value|
    fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I want to fill in.
I don't think I understand the question. You want Cucumber to guess
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally  - I'm subscribed to the cukes list along with 500 other
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden
734-926-9614
skype: lsiden
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
Mike Sassak
2009-11-14 22:02:34 UTC
Permalink
Post by lsiden
The placeholder names are the same as the field names, so there is no
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps definitions.
Guess I'll get started now, and use your answer, if I can, another
time.
Hi Larry,

Do you mean the placeholder in a Scenario Outline step? If that's the
case, then you can write a step in your scenario outline like:

Given I fill in "<placeholder>" with "<value>"

which should use the values from the examples table for placeholder
and value, and match the Webrat step definition.

Mike
Post by lsiden
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access the placeholder
name?
Given /^I type in "([^"]*)",$/ do |value|
    fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I want to fill in.
I don't think I understand the question. You want Cucumber to guess
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally  - I'm subscribed to the cukes list along with 500 other
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
lsiden
2009-11-15 16:01:50 UTC
Permalink
I'm not sure I made my goal clear. Let's say I have
Examples:
| first_name | last_name | ...
| Ichabod | Crane | ...
....

Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders. Then I would like to be able
to write something like this in my feature:

"And I type "<first_name>,...",

and then in my step def:

Given /^I type "([^\"]*)" ' do |value|
fill placeholder :with => value # expression 1
end

where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression (1) is
being evaluated. Instead I have to write:

'And I type "<first_name>" into field "first_name"'...

Then in the step def:

'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'

which works fine, but requires more typing, and thus has more
opportunity for error.

Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so there is no
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps definitions.
Guess I'll get started now, and use your answer, if I can, another
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If that's the
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access the placeholder
name?
Given /^I type in "([^"]*)",$/ do |value|
    fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I want to fill in.
I don't think I understand the question. You want Cucumber to guess
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally  - I'm subscribed to the cukes list along with 500 other
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group athttp://groups.google.com/group/cukes?hl=.
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
aslak hellesoy
2009-11-15 16:16:21 UTC
Permalink
I'm not sure I made my goal clear.  Let's say I have
   | first_name | last_name | ...
   | Ichabod     | Crane        | ...
   ....
I didn't understand from your first couple of emails that you were
using Scenario Outline and Examples tables. Now your question makes
more sense to me.
The term "placeholder name" isn't a term that conveys much contextual
meaning, although I know it's mentioned in the Scenario Outline wiki
page.

I suggest we use a different name for this. How about "Scenario
Outline parameter"?
Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders.  Then I would like to be able
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
   fill placeholder :with => value     # expression 1
end
What if I have something like this:

Scenario Outline: Eat veggies
Given I have <n> green <name> in my belly

Examples:
|n|name|
|7|potatoes|
|4|cukes|

And a step definition:

Given /I have (.*) green (.*) in my belly/ do |n, name|
# What would you expect the placeholder method to return in this case?
end

Aslak
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression (1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so there is no
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps definitions.
Guess I'll get started now, and use your answer, if I can, another
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If that's the
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access the placeholder
name?
Given /^I type in "([^"]*)",$/ do |value|
    fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I want to fill in.
I don't think I understand the question. You want Cucumber to guess
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally  - I'm subscribed to the cukes list along with 500 other
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group athttp://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
lsiden
2009-11-15 16:52:07 UTC
Permalink
Got me stumped!
Post by aslak hellesoy
I'm not sure I made my goal clear.  Let's say I have
   | first_name | last_name | ...
   | Ichabod     | Crane        | ...
   ....
I didn't understand from your first couple of emails that you were
using Scenario Outline and Examples tables. Now your question makes
more sense to me.
The term "placeholder name" isn't a term that conveys much contextual
meaning, although I know it's mentioned in the Scenario Outline wiki
page.
I suggest we use a different name for this. How about "Scenario
Outline parameter"?
Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders.  Then I would like to be able
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
   fill placeholder :with => value     # expression 1
end
Scenario Outline: Eat veggies
  Given I have <n> green <name> in my belly
    |n|name|
    |7|potatoes|
    |4|cukes|
Given /I have (.*) green (.*) in my belly/ do |n, name|
  # What would you expect the placeholder method to return in this case?
end
Aslak
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression (1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so there is no
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps definitions.
Guess I'll get started now, and use your answer, if I can, another
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If that's the
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access the placeholder
name?
Given /^I type in "([^"]*)",$/ do |value|
    fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I want to fill in.
I don't think I understand the question. You want Cucumber to guess
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally  - I'm subscribed to the cukes list along with 500 other
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group athttp://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group athttp://groups.google.com/group/cukes?hl=.
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
lsiden
2009-11-15 17:21:43 UTC
Permalink
Post by aslak hellesoy
# What would you expect the placeholder method to return in this case?
Aslak, FWIW, what if "placeholder" could be created as an array? Then
placeholder[0] == 'n', placeholder[1] == 'name'. Of course, I
understand that this would be only a convenience, although I'm sure
someone might find a more creative way to use this then to save me a
few keystrokes of typing. ;)
Post by aslak hellesoy
Got me stumped!
Post by aslak hellesoy
I'm not sure I made my goal clear.  Let's say I have
   | first_name | last_name | ...
   | Ichabod     | Crane        | ...
   ....
I didn't understand from your first couple of emails that you were
using Scenario Outline and Examples tables. Now your question makes
more sense to me.
The term "placeholder name" isn't a term that conveys much contextual
meaning, although I know it's mentioned in the Scenario Outline wiki
page.
I suggest we use a different name for this. How about "Scenario
Outline parameter"?
Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders.  Then I would like to be able
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
   fill placeholder :with => value     # expression 1
end
Scenario Outline: Eat veggies
  Given I have <n> green <name> in my belly
    |n|name|
    |7|potatoes|
    |4|cukes|
Given /I have (.*) green (.*) in my belly/ do |n, name|
  # What would you expect the placeholder method to return in this case?
end
Aslak
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression (1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so there is no
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps definitions.
Guess I'll get started now, and use your answer, if I can, another
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If that's the
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access the placeholder
name?
Given /^I type in "([^"]*)",$/ do |value|
    fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I want to fill in.
I don't think I understand the question. You want Cucumber to guess
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally  - I'm subscribed to the cukes list along with 500 other
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group athttp://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group athttp://groups.google.com/group/cukes?hl=.
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
aslak hellesoy
2009-11-15 17:48:00 UTC
Permalink
 >   # What would you expect the placeholder method to return in this
case?
Aslak, FWIW, what if "placeholder" could be created as an array?  Then
placeholder[0] == 'n', placeholder[1] == 'name'.  Of course, I
understand that this would be only a convenience, although I'm sure
someone might find a more creative way to use this then to save me a
few keystrokes of typing. ;)
I suggest:

placeholders # => return them all
placeholder # => alias for placeholders[0]

Could you please create a ticket for this in Lighthouse?

Aslak
Post by lsiden
Got me stumped!
Post by aslak hellesoy
I'm not sure I made my goal clear.  Let's say I have
   | first_name | last_name | ...
   | Ichabod     | Crane        | ...
   ....
I didn't understand from your first couple of emails that you were
using Scenario Outline and Examples tables. Now your question makes
more sense to me.
The term "placeholder name" isn't a term that conveys much contextual
meaning, although I know it's mentioned in the Scenario Outline wiki
page.
I suggest we use a different name for this. How about "Scenario
Outline parameter"?
Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders.  Then I would like to be able
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
   fill placeholder :with => value     # expression 1
end
Scenario Outline: Eat veggies
  Given I have <n> green <name> in my belly
    |n|name|
    |7|potatoes|
    |4|cukes|
Given /I have (.*) green (.*) in my belly/ do |n, name|
  # What would you expect the placeholder method to return in this case?
end
Aslak
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression (1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so there is no
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps definitions.
Guess I'll get started now, and use your answer, if I can, another
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If that's the
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access the placeholder
name?
Given /^I type in "([^"]*)",$/ do |value|
    fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I want to fill in.
I don't think I understand the question. You want Cucumber to guess
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally  - I'm subscribed to the cukes list along with 500 other
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group athttp://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group athttp://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
Larry Siden
2009-11-15 19:12:23 UTC
Permalink
Sure! I'll be glad to.

I am newbie at Ruby, and have been looking for something to crack my teeth
on besides little step definitions, so maybe I'll take a shot at it myself
while I tried to find work to keep the wolf away from the door. It can't
hurt - I can only learn something. If I come up with something that works,
I'll submit a patch. Thanks much for your support.

Larry Siden
http://umich.edu/~lsiden
734-926-9614
skype: lsiden


On Sun, Nov 15, 2009 at 12:48 PM, aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by aslak hellesoy
# What would you expect the placeholder method to return in this
case?
Aslak, FWIW, what if "placeholder" could be created as an array? Then
placeholder[0] == 'n', placeholder[1] == 'name'. Of course, I
understand that this would be only a convenience, although I'm sure
someone might find a more creative way to use this then to save me a
few keystrokes of typing. ;)
placeholders # => return them all
placeholder # => alias for placeholders[0]
Could you please create a ticket for this in Lighthouse?
Aslak
Post by lsiden
Post by aslak hellesoy
Got me stumped!
Post by aslak hellesoy
Post by lsiden
I'm not sure I made my goal clear. Let's say I have
| first_name | last_name | ...
| Ichabod | Crane | ...
....
I didn't understand from your first couple of emails that you were
using Scenario Outline and Examples tables. Now your question makes
more sense to me.
The term "placeholder name" isn't a term that conveys much contextual
meaning, although I know it's mentioned in the Scenario Outline wiki
page.
I suggest we use a different name for this. How about "Scenario
Outline parameter"?
Post by lsiden
Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders. Then I would like to be
able
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
fill placeholder :with => value # expression 1
end
Scenario Outline: Eat veggies
Given I have <n> green <name> in my belly
|n|name|
|7|potatoes|
|4|cukes|
Given /I have (.*) green (.*) in my belly/ do |n, name|
# What would you expect the placeholder method to return in this
case?
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
end
Aslak
Post by lsiden
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression (1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so there
is no
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps
definitions.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Guess I'll get started now, and use your answer, if I can,
another
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If that's
the
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access
the placeholder
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
name?
Given /^I type in "([^"]*)",$/ do |value|
fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I
want to fill in.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
I don't think I understand the question. You want Cucumber to
guess
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally - I'm subscribed to the cukes list along with 500
other
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden <http://umich.edu/%7Elsiden>
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the
Google Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
To unsubscribe from this group, send email to
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
To unsubscribe from this group, send email to
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
--
You received this message because you are subscribed to the Google Groups
"Cukes" group.
Post by lsiden
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
lsiden
2009-11-15 19:33:50 UTC
Permalink
Here's the ticket:
https://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/524-access-names-of-matched-placeholders-with-array
Sure!  I'll be glad to.
I am newbie at Ruby, and have been looking for something to crack my teeth
on besides little step definitions, so maybe I'll take a shot at it myself
while I tried to find work to keep the wolf away from the door.  It can't
hurt - I can only learn something.  If I come up with something that works,
I'll submit a patch.  Thanks much for your support.
Larry Sidenhttp://umich.edu/~lsiden
734-926-9614
skype: lsiden
On Sun, Nov 15, 2009 at 12:48 PM, aslak hellesoy
Post by aslak hellesoy
 >   # What would you expect the placeholder method to return in this
case?
Aslak, FWIW, what if "placeholder" could be created as an array?  Then
placeholder[0] == 'n', placeholder[1] == 'name'.  Of course, I
understand that this would be only a convenience, although I'm sure
someone might find a more creative way to use this then to save me a
few keystrokes of typing. ;)
placeholders # => return them all
placeholder # => alias for placeholders[0]
Could you please create a ticket for this in Lighthouse?
Aslak
Post by lsiden
Got me stumped!
Post by aslak hellesoy
I'm not sure I made my goal clear.  Let's say I have
   | first_name | last_name | ...
   | Ichabod     | Crane        | ...
   ....
I didn't understand from your first couple of emails that you were
using Scenario Outline and Examples tables. Now your question makes
more sense to me.
The term "placeholder name" isn't a term that conveys much contextual
meaning, although I know it's mentioned in the Scenario Outline wiki
page.
I suggest we use a different name for this. How about "Scenario
Outline parameter"?
Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders.  Then I would like to be
able
Post by lsiden
Post by aslak hellesoy
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
   fill placeholder :with => value     # expression 1
end
Scenario Outline: Eat veggies
  Given I have <n> green <name> in my belly
    |n|name|
    |7|potatoes|
    |4|cukes|
Given /I have (.*) green (.*) in my belly/ do |n, name|
  # What would you expect the placeholder method to return in this
case?
Post by lsiden
Post by aslak hellesoy
end
Aslak
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression (1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so there
is no
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps
definitions.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Guess I'll get started now, and use your answer, if I can,
another
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If that's
the
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access
the placeholder
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
name?
Given /^I type in "([^"]*)",$/ do |value|
    fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I
want to fill in.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
I don't think I understand the question. You want Cucumber to
guess
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally  - I'm subscribed to the cukes list along with 500
other
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden<http://umich.edu/%7Elsiden>
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the
Google Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
To unsubscribe from this group, send email to
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
Post by aslak hellesoy
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
To unsubscribe from this group, send email to
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups
"Cukes" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups
"Cukes" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
Matt Wynne
2009-11-15 19:46:48 UTC
Permalink
You need to bear in mind that there isn't a 1:1 mapping between
placeholders (or scenario outline parameters) used in in Scenario
Outlines and the regexp capture arguments that are passed to a step
definition.

For example, if there was very different behaviour for potatoes and
cukes in Aslak's example, you could equally implement those steps like
this:

Given /I have (.*) (.*) potatoes in my belly/ do |n, colour|
placeholder[1].should == "name" # surprise! you thought it would
return "colour", right?
end

Given /I have (.*) (.*) cukes in my belly/ do |n, colour|
end

I have a feeling that what you're asking for is built on the
assumption that placeholders:step args are always 1:1 - am I correct?
I think this feature could just exacerbate that confusion.
Post by lsiden
https://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/524-access-names-of-matched-placeholders-with-array
Post by Larry Siden
Sure! I'll be glad to.
I am newbie at Ruby, and have been looking for something to crack my teeth
on besides little step definitions, so maybe I'll take a shot at it myself
while I tried to find work to keep the wolf away from the door. It can't
hurt - I can only learn something. If I come up with something that works,
I'll submit a patch. Thanks much for your support.
Larry Sidenhttp://umich.edu/~lsiden
734-926-9614
skype: lsiden
On Sun, Nov 15, 2009 at 12:48 PM, aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by aslak hellesoy
# What would you expect the placeholder method to return in
this
case?
Aslak, FWIW, what if "placeholder" could be created as an array?
Then
placeholder[0] == 'n', placeholder[1] == 'name'. Of course, I
understand that this would be only a convenience, although I'm sure
someone might find a more creative way to use this then to save me a
few keystrokes of typing. ;)
placeholders # => return them all
placeholder # => alias for placeholders[0]
Could you please create a ticket for this in Lighthouse?
Aslak
Post by lsiden
Post by aslak hellesoy
Got me stumped!
Post by aslak hellesoy
Post by lsiden
I'm not sure I made my goal clear. Let's say I have
| first_name | last_name | ...
| Ichabod | Crane | ...
....
I didn't understand from your first couple of emails that you were
using Scenario Outline and Examples tables. Now your question makes
more sense to me.
The term "placeholder name" isn't a term that conveys much contextual
meaning, although I know it's mentioned in the Scenario Outline wiki
page.
I suggest we use a different name for this. How about "Scenario
Outline parameter"?
Post by lsiden
Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders. Then I would like to be
able
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
fill placeholder :with => value # expression 1
end
Scenario Outline: Eat veggies
Given I have <n> green <name> in my belly
|n|name|
|7|potatoes|
|4|cukes|
Given /I have (.*) green (.*) in my belly/ do |n, name|
# What would you expect the placeholder method to return in this
case?
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
end
Aslak
Post by lsiden
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression (1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so there
is no
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps
definitions.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Guess I'll get started now, and use your answer, if I can,
another
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If that's
the
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for
placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access
the placeholder
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
name?
Given /^I type in "([^"]*)",$/ do |value|
fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I
want to fill in.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
I don't think I understand the question. You want Cucumber to
guess
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally - I'm subscribed to the cukes list along with 500
other
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden<http://umich.edu/%7Elsiden>
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the
Google Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
To unsubscribe from this group, send email to
.
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
To unsubscribe from this group, send email to
.
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
--
You received this message because you are subscribed to the
Google Groups
"Cukes" group.
Post by lsiden
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups
"Cukes" group.
To unsubscribe from this group, send email to
Post by lsiden
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
.
For more options, visit this group at http://groups.google.com/group/cukes?hl=
.
cheers,
Matt

http://mattwynne.net
+447974 430184

--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
lsiden
2009-11-15 22:03:54 UTC
Permalink
I think I understand your concern, but what I proposed to Aslak is
that the assignment would depend only on the appearance of
placeholders in the scenario outline step, such that "Given I have <n>
green <name> in my belly" would yield placeholders == ['n', 'name'].
It would have nothing to do with the regular expression or what it
captures.
You need to bear in mind that there isn't a 1:1 mapping between  
placeholders (or scenario outline parameters) used in in Scenario  
Outlines and the regexp capture arguments that are passed to a step  
definition.
For example, if there was very different behaviour for potatoes and  
cukes in Aslak's example, you could equally implement those steps like  
   Given /I have (.*) (.*) potatoes in my belly/ do |n, colour|
     placeholder[1].should == "name" # surprise! you thought it would  
return "colour", right?
   end
   Given /I have (.*) (.*) cukes in my belly/ do |n, colour|
   end
I have a feeling that what you're asking for is built on the  
assumption that placeholders:step args are always 1:1 - am I correct?  
I think this feature could just exacerbate that confusion.
https://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/524-a...
Sure!  I'll be glad to.
I am newbie at Ruby, and have been looking for something to crack  
my teeth
on besides little step definitions, so maybe I'll take a shot at it  
myself
while I tried to find work to keep the wolf away from the door.  It  
can't
hurt - I can only learn something.  If I come up with something  
that works,
I'll submit a patch.  Thanks much for your support.
Larry Sidenhttp://umich.edu/~lsiden
734-926-9614
skype: lsiden
On Sun, Nov 15, 2009 at 12:48 PM, aslak hellesoy
Post by aslak hellesoy
 >   # What would you expect the placeholder method to return in  
this
case?
Aslak, FWIW, what if "placeholder" could be created as an array?  
Then
placeholder[0] == 'n', placeholder[1] == 'name'.  Of course, I
understand that this would be only a convenience, although I'm sure
someone might find a more creative way to use this then to save  
me a
few keystrokes of typing. ;)
placeholders # => return them all
placeholder # => alias for placeholders[0]
Could you please create a ticket for this in Lighthouse?
Aslak
Post by lsiden
Got me stumped!
I'm not sure I made my goal clear.  Let's say I have
   | first_name | last_name | ...
   | Ichabod     | Crane        | ...
   ....
I didn't understand from your first couple of emails that you  
were
using Scenario Outline and Examples tables. Now your question  
makes
more sense to me.
The term "placeholder name" isn't a term that conveys much  
contextual
meaning, although I know it's mentioned in the Scenario Outline  
wiki
page.
I suggest we use a different name for this. How about "Scenario
Outline parameter"?
Let's also assume I have been careful to use the names of my  
form
inputs as the names of my placeholders.  Then I would like to be
able
Post by lsiden
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
   fill placeholder :with => value     # expression 1
end
Scenario Outline: Eat veggies
  Given I have <n> green <name> in my belly
    |n|name|
    |7|potatoes|
    |4|cukes|
Given /I have (.*) green (.*) in my belly/ do |n, name|
  # What would you expect the placeholder method to return in  
this
case?
Post by lsiden
end
Aslak
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression  
(1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
The placeholder names are the same as the field names, so  
there
is no
Post by lsiden
Post by Mike Sassak
need to guess if I can find a way to access the placeholder  
name.
Otherwise, I will have to type 20 nearly identical steps
definitions.
Post by lsiden
Post by Mike Sassak
Guess I'll get started now, and use your answer, if I can,
another
Post by lsiden
Post by Mike Sassak
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If  
that's
the
Post by lsiden
Post by Mike Sassak
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for  
placeholder
and value, and match the Webrat step definition.
Mike
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access
the placeholder
Post by lsiden
Post by Mike Sassak
Post by aslak hellesoy
name?
Given /^I type in "([^"]*)",$/ do |value|
    fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I
want to fill in.
Post by lsiden
Post by Mike Sassak
Post by aslak hellesoy
I don't think I understand the question. You want Cucumber to
guess
Post by lsiden
Post by Mike Sassak
Post by aslak hellesoy
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally  - I'm subscribed to the cukes list along with 500
other
Post by lsiden
Post by Mike Sassak
Post by aslak hellesoy
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden<http://umich.edu/%7Elsiden>
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the
Google Groups "Cukes" group.
Post by lsiden
Post by Mike Sassak
To unsubscribe from this group, send email to
.
Post by lsiden
Post by Mike Sassak
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
--
You received this message because you are subscribed to the  
Google
Groups "Cukes" group.
Post by lsiden
To unsubscribe from this group, send email to
.
Post by lsiden
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the  
Google Groups
"Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google  
Groups
"Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google  
Groups "Cukes" group.
.
For more options, visit this group athttp://groups.google.com/group/cukes?hl=
.
cheers,
Matt
http://mattwynne.net
+447974 430184
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
aslak hellesoy
2009-11-15 22:07:39 UTC
Permalink
Post by lsiden
I think I understand your concern, but what I proposed to Aslak is
that the assignment would depend only on the appearance of
placeholders in the scenario outline step, such that "Given I have <n>
green <name> in my belly" would yield placeholders == ['n', 'name'].
It would have nothing to do with the regular expression or what it
captures.
I was thinking the same thing Larry. Agree Matt?

Aslak
Post by lsiden
Post by Matt Wynne
You need to bear in mind that there isn't a 1:1 mapping between
placeholders (or scenario outline parameters) used in in Scenario
Outlines and the regexp capture arguments that are passed to a step
definition.
For example, if there was very different behaviour for potatoes and
cukes in Aslak's example, you could equally implement those steps like
   Given /I have (.*) (.*) potatoes in my belly/ do |n, colour|
     placeholder[1].should == "name" # surprise! you thought it would
return "colour", right?
   end
   Given /I have (.*) (.*) cukes in my belly/ do |n, colour|
   end
I have a feeling that what you're asking for is built on the
assumption that placeholders:step args are always 1:1 - am I correct?
I think this feature could just exacerbate that confusion.
https://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/524-a...
Sure!  I'll be glad to.
I am newbie at Ruby, and have been looking for something to crack my teeth
on besides little step definitions, so maybe I'll take a shot at it myself
while I tried to find work to keep the wolf away from the door.  It can't
hurt - I can only learn something.  If I come up with something that works,
I'll submit a patch.  Thanks much for your support.
Larry Sidenhttp://umich.edu/~lsiden
734-926-9614
skype: lsiden
On Sun, Nov 15, 2009 at 12:48 PM, aslak hellesoy
Post by aslak hellesoy
 >   # What would you expect the placeholder method to return in this
case?
Aslak, FWIW, what if "placeholder" could be created as an array?
Then
placeholder[0] == 'n', placeholder[1] == 'name'.  Of course, I
understand that this would be only a convenience, although I'm sure
someone might find a more creative way to use this then to save me a
few keystrokes of typing. ;)
placeholders # => return them all
placeholder # => alias for placeholders[0]
Could you please create a ticket for this in Lighthouse?
Aslak
Post by lsiden
Got me stumped!
Post by aslak hellesoy
I'm not sure I made my goal clear.  Let's say I have
   | first_name | last_name | ...
   | Ichabod     | Crane        | ...
   ....
I didn't understand from your first couple of emails that you were
using Scenario Outline and Examples tables. Now your question makes
more sense to me.
The term "placeholder name" isn't a term that conveys much contextual
meaning, although I know it's mentioned in the Scenario Outline wiki
page.
I suggest we use a different name for this. How about "Scenario
Outline parameter"?
Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders.  Then I would like to be
able
Post by lsiden
Post by aslak hellesoy
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
   fill placeholder :with => value     # expression 1
end
Scenario Outline: Eat veggies
  Given I have <n> green <name> in my belly
    |n|name|
    |7|potatoes|
    |4|cukes|
Given /I have (.*) green (.*) in my belly/ do |n, name|
  # What would you expect the placeholder method to return in this
case?
Post by lsiden
Post by aslak hellesoy
end
Aslak
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression (1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so there
is no
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps
definitions.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Guess I'll get started now, and use your answer, if I can,
another
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If that's
the
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access
the placeholder
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
name?
Given /^I type in "([^"]*)",$/ do |value|
    fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I
want to fill in.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
I don't think I understand the question. You want Cucumber to
guess
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally  - I'm subscribed to the cukes list along with 500
other
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden<http://umich.edu/%7Elsiden>
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the
Google Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
To unsubscribe from this group, send email to
.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
Post by aslak hellesoy
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
To unsubscribe from this group, send email to
.
Post by lsiden
Post by aslak hellesoy
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups
"Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups
"Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
.
For more options, visit this group athttp://groups.google.com/group/cukes?hl=
.
cheers,
Matt
http://mattwynne.net
+447974 430184
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
Matt Wynne
2009-11-16 00:20:28 UTC
Permalink
Post by aslak hellesoy
Post by lsiden
I think I understand your concern, but what I proposed to Aslak is
that the assignment would depend only on the appearance of
placeholders in the scenario outline step, such that "Given I have <n>
green <name> in my belly" would yield placeholders == ['n', 'name'].
It would have nothing to do with the regular expression or what it
captures.
I was thinking the same thing Larry. Agree Matt?
Okay cool, I'm glad we all get that :)

Don't you think it would be quite weird that you'd end up building a
step definition that could only be used in a scenario outline though?
Seems to me that could make for brittle features.

I guess there's not really any harm in it but I do worry it has the
potential to confuse more people than it helps. Sorry if I sound like
a curmudgeon ;)
Post by aslak hellesoy
Aslak
Post by lsiden
Post by Matt Wynne
You need to bear in mind that there isn't a 1:1 mapping between
placeholders (or scenario outline parameters) used in in Scenario
Outlines and the regexp capture arguments that are passed to a step
definition.
For example, if there was very different behaviour for potatoes and
cukes in Aslak's example, you could equally implement those steps like
Given /I have (.*) (.*) potatoes in my belly/ do |n, colour|
placeholder[1].should == "name" # surprise! you thought it would
return "colour", right?
end
Given /I have (.*) (.*) cukes in my belly/ do |n, colour|
end
I have a feeling that what you're asking for is built on the
assumption that placeholders:step args are always 1:1 - am I
correct?
I think this feature could just exacerbate that confusion.
Post by lsiden
https://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/524-a
...
Post by Larry Siden
Sure! I'll be glad to.
I am newbie at Ruby, and have been looking for something to crack my teeth
on besides little step definitions, so maybe I'll take a shot at
it
myself
while I tried to find work to keep the wolf away from the door.
It
can't
hurt - I can only learn something. If I come up with something that works,
I'll submit a patch. Thanks much for your support.
Larry Sidenhttp://umich.edu/~lsiden
734-926-9614
skype: lsiden
On Sun, Nov 15, 2009 at 12:48 PM, aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by aslak hellesoy
# What would you expect the placeholder method to return in
this
case?
Aslak, FWIW, what if "placeholder" could be created as an array?
Then
placeholder[0] == 'n', placeholder[1] == 'name'. Of course, I
understand that this would be only a convenience, although I'm sure
someone might find a more creative way to use this then to save me a
few keystrokes of typing. ;)
placeholders # => return them all
placeholder # => alias for placeholders[0]
Could you please create a ticket for this in Lighthouse?
Aslak
Post by lsiden
Post by aslak hellesoy
Got me stumped!
Post by aslak hellesoy
Post by lsiden
I'm not sure I made my goal clear. Let's say I have
| first_name | last_name | ...
| Ichabod | Crane | ...
....
I didn't understand from your first couple of emails that you were
using Scenario Outline and Examples tables. Now your question makes
more sense to me.
The term "placeholder name" isn't a term that conveys much contextual
meaning, although I know it's mentioned in the Scenario
Outline
wiki
page.
I suggest we use a different name for this. How about
"Scenario
Outline parameter"?
Post by lsiden
Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders. Then I would like to be
able
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
fill placeholder :with => value # expression 1
end
Scenario Outline: Eat veggies
Given I have <n> green <name> in my belly
|n|name|
|7|potatoes|
|4|cukes|
Given /I have (.*) green (.*) in my belly/ do |n, name|
# What would you expect the placeholder method to return in this
case?
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
end
Aslak
Post by lsiden
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression (1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so there
is no
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps
definitions.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Guess I'll get started now, and use your answer, if I can,
another
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If that's
the
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
On Nov 14, 3:52 pm, aslak hellesoy
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access
the placeholder
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
name?
Given /^I type in "([^"]*)",$/ do |value|
fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I
want to fill in.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
I don't think I understand the question. You want
Cucumber to
guess
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally - I'm subscribed to the cukes list along with 500
other
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden<http://umich.edu/%7Elsiden>
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the
Google Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
To post to this group, send email to
To unsubscribe from this group, send email to
.
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
To unsubscribe from this group, send email to
.
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
--
You received this message because you are subscribed to the Google Groups
"Cukes" group.
Post by lsiden
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google
Groups
"Cukes" group.
To unsubscribe from this group, send email to
Post by lsiden
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
.
For more options, visit this group athttp://groups.google.com/group/cukes?hl=
.
cheers,
Matt
http://mattwynne.net
+447974 430184
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
.
For more options, visit this group at http://groups.google.com/group/cukes?hl=
.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
.
For more options, visit this group at http://groups.google.com/group/cukes?hl=
.
cheers,
Matt

+447974 430184
matt-***@public.gmane.org
http://mattwynne.net

--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
aslak hellesoy
2009-11-16 00:29:15 UTC
Permalink
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
I think I understand your concern, but what I proposed to Aslak is
that the assignment would depend only on the appearance of
placeholders in the scenario outline step, such that "Given I have <n>
green <name> in my belly" would yield placeholders == ['n', 'name'].
It would have nothing to do with the regular expression or what it
captures.
I was thinking the same thing Larry. Agree Matt?
Okay cool, I'm glad we all get that :)
Don't you think it would be quite weird that you'd end up building a
step definition that could only be used in a scenario outline though?
Seems to me that could make for brittle features.
Good point Matt
Post by Matt Wynne
I guess there's not really any harm in it but I do worry it has the
potential to confuse more people than it helps. Sorry if I sound like
a curmudgeon ;)
Those are valid points. I think adding this feature would be
marginally useful and potentially confusing, so I'm not very keen on
it.

Cheers,
Aslak
Post by Matt Wynne
Post by aslak hellesoy
Aslak
Post by lsiden
Post by Matt Wynne
You need to bear in mind that there isn't a 1:1 mapping between
placeholders (or scenario outline parameters) used in in Scenario
Outlines and the regexp capture arguments that are passed to a step
definition.
For example, if there was very different behaviour for potatoes and
cukes in Aslak's example, you could equally implement those steps like
   Given /I have (.*) (.*) potatoes in my belly/ do |n, colour|
     placeholder[1].should == "name" # surprise! you thought it would
return "colour", right?
   end
   Given /I have (.*) (.*) cukes in my belly/ do |n, colour|
   end
I have a feeling that what you're asking for is built on the
assumption that placeholders:step args are always 1:1 - am I correct?
I think this feature could just exacerbate that confusion.
Post by lsiden
https://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/524-a
...
Sure!  I'll be glad to.
I am newbie at Ruby, and have been looking for something to crack my teeth
on besides little step definitions, so maybe I'll take a shot at
it
myself
while I tried to find work to keep the wolf away from the door.
It
can't
hurt - I can only learn something.  If I come up with something that works,
I'll submit a patch.  Thanks much for your support.
Larry Sidenhttp://umich.edu/~lsiden
734-926-9614
skype: lsiden
On Sun, Nov 15, 2009 at 12:48 PM, aslak hellesoy
Post by aslak hellesoy
 >   # What would you expect the placeholder method to return in this
case?
Aslak, FWIW, what if "placeholder" could be created as an array?
Then
placeholder[0] == 'n', placeholder[1] == 'name'.  Of course, I
understand that this would be only a convenience, although I'm sure
someone might find a more creative way to use this then to save me a
few keystrokes of typing. ;)
placeholders # => return them all
placeholder # => alias for placeholders[0]
Could you please create a ticket for this in Lighthouse?
Aslak
Post by lsiden
Got me stumped!
Post by aslak hellesoy
I'm not sure I made my goal clear.  Let's say I have
   | first_name | last_name | ...
   | Ichabod     | Crane        | ...
   ....
I didn't understand from your first couple of emails that you were
using Scenario Outline and Examples tables. Now your question makes
more sense to me.
The term "placeholder name" isn't a term that conveys much contextual
meaning, although I know it's mentioned in the Scenario
Outline
wiki
page.
I suggest we use a different name for this. How about
"Scenario
Outline parameter"?
Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders.  Then I would like to be
able
Post by lsiden
Post by aslak hellesoy
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
   fill placeholder :with => value     # expression 1
end
Scenario Outline: Eat veggies
  Given I have <n> green <name> in my belly
    |n|name|
    |7|potatoes|
    |4|cukes|
Given /I have (.*) green (.*) in my belly/ do |n, name|
  # What would you expect the placeholder method to return in this
case?
Post by lsiden
Post by aslak hellesoy
end
Aslak
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression (1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so there
is no
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps
definitions.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Guess I'll get started now, and use your answer, if I can,
another
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If that's
the
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
On Nov 14, 3:52 pm, aslak hellesoy
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to access
the placeholder
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
name?
Given /^I type in "([^"]*)",$/ do |value|
    fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I
want to fill in.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
I don't think I understand the question. You want
Cucumber to
guess
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally  - I'm subscribed to the cukes list along with 500
other
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden<http://umich.edu/%7Elsiden>
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the
Google Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
To post to this group, send email to
To unsubscribe from this group, send email to
.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
Post by aslak hellesoy
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
To unsubscribe from this group, send email to
.
Post by lsiden
Post by aslak hellesoy
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups
"Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google
Groups
"Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
.
For more options, visit this group athttp://groups.google.com/group/cukes?hl=
.
cheers,
Matt
http://mattwynne.net
+447974 430184
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
.
For more options, visit this group at http://groups.google.com/group/cukes?hl=
.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
.
For more options, visit this group at http://groups.google.com/group/cukes?hl=
.
cheers,
Matt
+447974 430184
http://mattwynne.net
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
Gregory Hnatiuk
2009-11-16 02:24:32 UTC
Permalink
Larry, would something like the following work?

Scenario Outline: Filling out a very picky registration form
...
When I fill in the following fields with:
| First Name | Last Name | Address | Country |
| <first_name> | <last_name> | <address> | <country> |
And I click 'submit'
Then the result should be <result>
....

Examples
| first_name | last_name | address | country | result |
| Greg | Hnatiuk | 23 st. | US | good |
| Someone | Else | 0 | nowhere | bad |

Given /^I fill out the following fields with:$/ do |table|
table.hashes.first.each do |k,v|
Given %Q{I fill in "#{k}" with "#{v}"}
end
end

Greg
Post by aslak hellesoy
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
I think I understand your concern, but what I proposed to Aslak is
that the assignment would depend only on the appearance of
placeholders in the scenario outline step, such that "Given I have <n>
green <name> in my belly" would yield placeholders == ['n', 'name'].
It would have nothing to do with the regular expression or what it
captures.
I was thinking the same thing Larry. Agree Matt?
Okay cool, I'm glad we all get that :)
Don't you think it would be quite weird that you'd end up building a
step definition that could only be used in a scenario outline though?
Seems to me that could make for brittle features.
Good point Matt
Post by Matt Wynne
I guess there's not really any harm in it but I do worry it has the
potential to confuse more people than it helps. Sorry if I sound like
a curmudgeon ;)
Those are valid points. I think adding this feature would be
marginally useful and potentially confusing, so I'm not very keen on
it.
Cheers,
Aslak
Post by Matt Wynne
Post by aslak hellesoy
Aslak
Post by lsiden
Post by Matt Wynne
You need to bear in mind that there isn't a 1:1 mapping between
placeholders (or scenario outline parameters) used in in Scenario
Outlines and the regexp capture arguments that are passed to a step
definition.
For example, if there was very different behaviour for potatoes and
cukes in Aslak's example, you could equally implement those steps like
Given /I have (.*) (.*) potatoes in my belly/ do |n, colour|
placeholder[1].should == "name" # surprise! you thought it would
return "colour", right?
end
Given /I have (.*) (.*) cukes in my belly/ do |n, colour|
end
I have a feeling that what you're asking for is built on the
assumption that placeholders:step args are always 1:1 - am I correct?
I think this feature could just exacerbate that confusion.
https://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/524-a
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
Post by Matt Wynne
Post by aslak hellesoy
...
Post by Larry Siden
Sure! I'll be glad to.
I am newbie at Ruby, and have been looking for something to crack my teeth
on besides little step definitions, so maybe I'll take a shot at
it
myself
while I tried to find work to keep the wolf away from the door.
It
can't
hurt - I can only learn something. If I come up with something that works,
I'll submit a patch. Thanks much for your support.
Larry Sidenhttp://umich.edu/~lsiden
734-926-9614
skype: lsiden
On Sun, Nov 15, 2009 at 12:48 PM, aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by aslak hellesoy
# What would you expect the placeholder method to return in
this
case?
Aslak, FWIW, what if "placeholder" could be created as an array?
Then
placeholder[0] == 'n', placeholder[1] == 'name'. Of course, I
understand that this would be only a convenience, although I'm sure
someone might find a more creative way to use this then to save me a
few keystrokes of typing. ;)
placeholders # => return them all
placeholder # => alias for placeholders[0]
Could you please create a ticket for this in Lighthouse?
Aslak
Post by lsiden
Post by aslak hellesoy
Got me stumped!
Post by aslak hellesoy
Post by lsiden
I'm not sure I made my goal clear. Let's say I have
| first_name | last_name | ...
| Ichabod | Crane | ...
....
I didn't understand from your first couple of emails that you were
using Scenario Outline and Examples tables. Now your question makes
more sense to me.
The term "placeholder name" isn't a term that conveys much contextual
meaning, although I know it's mentioned in the Scenario
Outline
wiki
page.
I suggest we use a different name for this. How about "Scenario
Outline parameter"?
Post by lsiden
Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders. Then I would like to be
able
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
fill placeholder :with => value # expression 1
end
Scenario Outline: Eat veggies
Given I have <n> green <name> in my belly
|n|name|
|7|potatoes|
|4|cukes|
Given /I have (.*) green (.*) in my belly/ do |n, name|
# What would you expect the placeholder method to return in this
case?
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
end
Aslak
Post by lsiden
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression (1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so there
is no
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
need to guess if I can find a way to access the placeholder
name.
Otherwise, I will have to type 20 nearly identical steps
definitions.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Guess I'll get started now, and use your answer, if I can,
another
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If that's
the
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for
placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
On Nov 14, 3:52 pm, aslak hellesoy
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to
access
the placeholder
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
name?
Given /^I type in "([^"]*)",$/ do |value|
fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I
want to fill in.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
I don't think I understand the question. You want Cucumber to
guess
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally - I'm subscribed to the cukes list along with 500
other
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden<http://umich.edu/%7Elsiden>
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the
Google Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
To post to this group, send email to
To unsubscribe from this group, send email to
.
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
To unsubscribe from this group, send email to
.
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
--
You received this message because you are subscribed to the Google Groups
"Cukes" group.
Post by lsiden
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google
Groups
"Cukes" group.
To unsubscribe from this group, send email to
Post by lsiden
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
Post by Matt Wynne
Post by aslak hellesoy
.
cheers,
Matt
http://mattwynne.net
+447974 430184
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
.
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=
Post by Matt Wynne
Post by aslak hellesoy
.
cheers,
Matt
+447974 430184
http://mattwynne.net
--
You received this message because you are subscribed to the Google Groups
"Cukes" group.
Post by Matt Wynne
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
aslak hellesoy
2009-11-16 02:51:15 UTC
Permalink
Post by Gregory Hnatiuk
Larry, would something like the following work?
Scenario Outline:  Filling out a very picky registration form
   ...
       | First Name    | Last Name    | Address     | Country       |
       | <first_name> | <last_name>  | <address> | <country>     |
   And I click 'submit'
   Then the result should be <result>
   ....
  Examples
      | first_name | last_name | address | country   |  result |
      | Greg         | Hnatiuk     | 23 st.    | US         |  good  |
      | Someone  | Else          | 0          | nowhere |  bad    |
Given /^I fill out the following fields with:$/ do |table|
    table.hashes.first.each do |k,v|
       Given %Q{I fill in "#{k}" with "#{v}"}
    end
end
Or even:

When I fill in the following fields with:
| First Name | <first_name> |
| Last Name | <last_name> |
| Address | <address> |
| Country |<country> |

and in the stepdef: table.rows_hash.each do |k,v|

Aslak
Post by Gregory Hnatiuk
Greg
Post by aslak hellesoy
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
I think I understand your concern, but what I proposed to Aslak is
that the assignment would depend only on the appearance of
placeholders in the scenario outline step, such that "Given I have <n>
green <name> in my belly" would yield placeholders == ['n', 'name'].
It would have nothing to do with the regular expression or what it
captures.
I was thinking the same thing Larry. Agree Matt?
Okay cool, I'm glad we all get that :)
Don't you think it would be quite weird that you'd end up building a
step definition that could only be used in a scenario outline though?
Seems to me that could make for brittle features.
Good point Matt
Post by Matt Wynne
I guess there's not really any harm in it but I do worry it has the
potential to confuse more people than it helps. Sorry if I sound like
a curmudgeon ;)
Those are valid points. I think adding this feature would be
marginally useful and potentially confusing, so I'm not very keen on
it.
Cheers,
Aslak
Post by Matt Wynne
Post by aslak hellesoy
Aslak
Post by lsiden
Post by Matt Wynne
You need to bear in mind that there isn't a 1:1 mapping between
placeholders (or scenario outline parameters) used in in Scenario
Outlines and the regexp capture arguments that are passed to a step
definition.
For example, if there was very different behaviour for potatoes and
cukes in Aslak's example, you could equally implement those steps like
   Given /I have (.*) (.*) potatoes in my belly/ do |n, colour|
     placeholder[1].should == "name" # surprise! you thought it would
return "colour", right?
   end
   Given /I have (.*) (.*) cukes in my belly/ do |n, colour|
   end
I have a feeling that what you're asking for is built on the
assumption that placeholders:step args are always 1:1 - am I correct?
I think this feature could just exacerbate that confusion.
Post by lsiden
https://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/524-a
...
Sure!  I'll be glad to.
I am newbie at Ruby, and have been looking for something to crack my teeth
on besides little step definitions, so maybe I'll take a shot at
it
myself
while I tried to find work to keep the wolf away from the door.
It
can't
hurt - I can only learn something.  If I come up with something
that works,
I'll submit a patch.  Thanks much for your support.
Larry Sidenhttp://umich.edu/~lsiden
734-926-9614
skype: lsiden
On Sun, Nov 15, 2009 at 12:48 PM, aslak hellesoy
Post by aslak hellesoy
 >   # What would you expect the placeholder method to return in this
case?
Aslak, FWIW, what if "placeholder" could be created as an array?
Then
placeholder[0] == 'n', placeholder[1] == 'name'.  Of course, I
understand that this would be only a convenience, although I'm sure
someone might find a more creative way to use this then to save me a
few keystrokes of typing. ;)
placeholders # => return them all
placeholder # => alias for placeholders[0]
Could you please create a ticket for this in Lighthouse?
Aslak
Post by lsiden
Got me stumped!
Post by aslak hellesoy
I'm not sure I made my goal clear.  Let's say I have
   | first_name | last_name | ...
   | Ichabod     | Crane        | ...
   ....
I didn't understand from your first couple of emails that you were
using Scenario Outline and Examples tables. Now your question makes
more sense to me.
The term "placeholder name" isn't a term that conveys much
contextual
meaning, although I know it's mentioned in the Scenario
Outline
wiki
page.
I suggest we use a different name for this. How about "Scenario
Outline parameter"?
Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders.  Then I would like to be
able
Post by lsiden
Post by aslak hellesoy
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
   fill placeholder :with => value     # expression 1
end
Scenario Outline: Eat veggies
  Given I have <n> green <name> in my belly
    |n|name|
    |7|potatoes|
    |4|cukes|
Given /I have (.*) green (.*) in my belly/ do |n, name|
  # What would you expect the placeholder method to return in this
case?
Post by lsiden
Post by aslak hellesoy
end
Aslak
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression
(1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so
there
is no
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
need to guess if I can find a way to access the placeholder
name.
Otherwise, I will have to type 20 nearly identical steps
definitions.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Guess I'll get started now, and use your answer, if I can,
another
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If
that's
the
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for
placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
On Nov 14, 3:52 pm, aslak hellesoy
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to
access
the placeholder
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
name?
Given /^I type in "([^"]*)",$/ do |value|
    fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the
field I
want to fill in.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
I don't think I understand the question. You want
Cucumber to
guess
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions
to me
personally  - I'm subscribed to the cukes list along
with 500
other
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden<http://umich.edu/%7Elsiden>
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the
Google Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
To post to this group, send email to
To unsubscribe from this group, send email to
.
Post by lsiden
Post by aslak hellesoy
Post by Mike Sassak
Post by lsiden
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
Post by aslak hellesoy
--
You received this message because you are subscribed to the
Google
Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
To unsubscribe from this group, send email to
.
Post by lsiden
Post by aslak hellesoy
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the
Google Groups
"Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google
Groups
"Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group
athttp://groups.google.com/group/cukes?hl=
.
cheers,
Matt
http://mattwynne.net
+447974 430184
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=
.
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=
.
cheers,
Matt
+447974 430184
http://mattwynne.net
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
Larry Siden
2009-11-16 03:02:03 UTC
Permalink
Matt Wynn wrote: "Don't you think it would be quite weird that you'd end up
building a
step definition that could only be used in a scenario outline though?
Seems to me that could make for brittle features."

I didn't think of that, Matt. I'm a newbie so it didn't occur to me that
step definitions should not be so tightly coupled to the scenarios.

As for Gregory and Aslaks alternate solutions, I need to do a bit more
reading so that I can understand them fully. I haven't used those
constructs yet. Maybe if I had known about them I wouldn't have asked my
question in the first place.

I have to get back to some paying work now (what I originally wrote this to
test!), so I'm gonna have to let it go for now and move on. I appreciate
your responses.

Larry Siden
http://umich.edu/~lsiden
734-926-9614
skype: lsiden
Post by aslak hellesoy
Post by Gregory Hnatiuk
Larry, would something like the following work?
Scenario Outline: Filling out a very picky registration form
...
| First Name | Last Name | Address | Country |
| <first_name> | <last_name> | <address> | <country> |
And I click 'submit'
Then the result should be <result>
....
Examples
| first_name | last_name | address | country | result |
| Greg | Hnatiuk | 23 st. | US | good |
| Someone | Else | 0 | nowhere | bad |
Given /^I fill out the following fields with:$/ do |table|
table.hashes.first.each do |k,v|
Given %Q{I fill in "#{k}" with "#{v}"}
end
end
| First Name | <first_name> |
| Last Name | <last_name> |
| Address | <address> |
| Country |<country> |
and in the stepdef: table.rows_hash.each do |k,v|
Aslak
Post by Gregory Hnatiuk
Greg
On Sun, Nov 15, 2009 at 7:29 PM, aslak hellesoy <
Post by aslak hellesoy
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
I think I understand your concern, but what I proposed to Aslak is
that the assignment would depend only on the appearance of
placeholders in the scenario outline step, such that "Given I have <n>
green <name> in my belly" would yield placeholders == ['n', 'name'].
It would have nothing to do with the regular expression or what it
captures.
I was thinking the same thing Larry. Agree Matt?
Okay cool, I'm glad we all get that :)
Don't you think it would be quite weird that you'd end up building a
step definition that could only be used in a scenario outline though?
Seems to me that could make for brittle features.
Good point Matt
Post by Matt Wynne
I guess there's not really any harm in it but I do worry it has the
potential to confuse more people than it helps. Sorry if I sound like
a curmudgeon ;)
Those are valid points. I think adding this feature would be
marginally useful and potentially confusing, so I'm not very keen on
it.
Cheers,
Aslak
Post by Matt Wynne
Post by aslak hellesoy
Aslak
Post by lsiden
Post by Matt Wynne
You need to bear in mind that there isn't a 1:1 mapping between
placeholders (or scenario outline parameters) used in in Scenario
Outlines and the regexp capture arguments that are passed to a step
definition.
For example, if there was very different behaviour for potatoes and
cukes in Aslak's example, you could equally implement those steps like
Given /I have (.*) (.*) potatoes in my belly/ do |n, colour|
placeholder[1].should == "name" # surprise! you thought it would
return "colour", right?
end
Given /I have (.*) (.*) cukes in my belly/ do |n, colour|
end
I have a feeling that what you're asking for is built on the
assumption that placeholders:step args are always 1:1 - am I correct?
I think this feature could just exacerbate that confusion.
https://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/524-a
Post by Gregory Hnatiuk
Post by aslak hellesoy
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
Post by Matt Wynne
Post by aslak hellesoy
...
Post by Larry Siden
Sure! I'll be glad to.
I am newbie at Ruby, and have been looking for something to crack
my teeth
on besides little step definitions, so maybe I'll take a shot at
it
myself
while I tried to find work to keep the wolf away from the door.
It
can't
hurt - I can only learn something. If I come up with something
that works,
I'll submit a patch. Thanks much for your support.
Larry Sidenhttp://umich.edu/~lsiden <http://umich.edu/%7Elsiden>
734-926-9614
skype: lsiden
On Sun, Nov 15, 2009 at 12:48 PM, aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by aslak hellesoy
# What would you expect the placeholder method to return
in
Post by Gregory Hnatiuk
Post by aslak hellesoy
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
Post by Matt Wynne
Post by aslak hellesoy
Post by Larry Siden
Post by aslak hellesoy
Post by lsiden
this
case?
Aslak, FWIW, what if "placeholder" could be created as an
array?
Post by Gregory Hnatiuk
Post by aslak hellesoy
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
Post by Matt Wynne
Post by aslak hellesoy
Post by Larry Siden
Post by aslak hellesoy
Post by lsiden
Then
placeholder[0] == 'n', placeholder[1] == 'name'. Of course, I
understand that this would be only a convenience, although I'm sure
someone might find a more creative way to use this then to save
me a
few keystrokes of typing. ;)
placeholders # => return them all
placeholder # => alias for placeholders[0]
Could you please create a ticket for this in Lighthouse?
Aslak
Post by lsiden
Post by aslak hellesoy
Got me stumped!
Post by aslak hellesoy
Post by lsiden
I'm not sure I made my goal clear. Let's say I have
| first_name | last_name | ...
| Ichabod | Crane | ...
....
I didn't understand from your first couple of emails that you
were
using Scenario Outline and Examples tables. Now your question
makes
more sense to me.
The term "placeholder name" isn't a term that conveys much
contextual
meaning, although I know it's mentioned in the Scenario
Outline
wiki
page.
I suggest we use a different name for this. How about "Scenario
Outline parameter"?
Post by lsiden
Let's also assume I have been careful to use the names of my
form
inputs as the names of my placeholders. Then I would like
to be
able
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
fill placeholder :with => value # expression 1
end
Scenario Outline: Eat veggies
Given I have <n> green <name> in my belly
|n|name|
|7|potatoes|
|4|cukes|
Given /I have (.*) green (.*) in my belly/ do |n, name|
# What would you expect the placeholder method to return in
this
case?
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
end
Aslak
Post by lsiden
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression
(1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has
more
Post by Gregory Hnatiuk
Post by aslak hellesoy
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
Post by Matt Wynne
Post by aslak hellesoy
Post by Larry Siden
Post by aslak hellesoy
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
opportunity for error.
Just a suggestion for a future release.
Post by Mike Sassak
Post by lsiden
The placeholder names are the same as the field names, so
there
is no
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
need to guess if I can find a way to access the
placeholder
Post by Gregory Hnatiuk
Post by aslak hellesoy
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
Post by Matt Wynne
Post by aslak hellesoy
Post by Larry Siden
Post by aslak hellesoy
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
name.
Otherwise, I will have to type 20 nearly identical steps
definitions.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Guess I'll get started now, and use your answer, if I can,
another
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If
that's
the
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
case, then you can write a step in your scenario outline
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for
placeholder
and value, and match the Webrat step definition.
Mike
Post by lsiden
On Nov 14, 3:52 pm, aslak hellesoy
Post by aslak hellesoy
Aslak, in a step definition, is it possible for me to
access
the placeholder
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
name?
Given /^I type in "([^"]*)",$/ do |value|
fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the
field I
want to fill in.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
I don't think I understand the question. You want
Cucumber to
guess
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions
to me
personally - I'm subscribed to the cukes list along
with 500
other
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden <http://umich.edu/%7Elsiden><
http://umich.edu/%7Elsiden>
Post by Gregory Hnatiuk
Post by aslak hellesoy
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
Post by Matt Wynne
Post by aslak hellesoy
Post by Larry Siden
Post by aslak hellesoy
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
Post by aslak hellesoy
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to
the
Post by Gregory Hnatiuk
Post by aslak hellesoy
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
Post by Matt Wynne
Post by aslak hellesoy
Post by Larry Siden
Post by aslak hellesoy
Google Groups "Cukes" group.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
To post to this group, send email to
To unsubscribe from this group, send email to
.
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
Post by Mike Sassak
Post by lsiden
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
--
You received this message because you are subscribed to the
Google
Groups "Cukes" group.
.
Post by Gregory Hnatiuk
Post by aslak hellesoy
Post by Matt Wynne
Post by aslak hellesoy
Post by lsiden
Post by Matt Wynne
Post by aslak hellesoy
Post by Larry Siden
Post by aslak hellesoy
Post by lsiden
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
To unsubscribe from this group, send email to
.
Post by aslak hellesoy
Post by aslak hellesoy
Post by lsiden
For more options, visit this group athttp://
groups.google.com/group/cukes?hl=.
Post by lsiden
--
You received this message because you are subscribed to the
Google Groups
"Cukes" group.
Post by lsiden
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google
Groups
"Cukes" group.
To unsubscribe from this group, send email to
Post by lsiden
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group
athttp://groups.google.com/group/cukes?hl=
.
cheers,
Matt
http://mattwynne.net
+447974 430184
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=
.
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/cukes?hl=
.
cheers,
Matt
+447974 430184
http://mattwynne.net
--
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group, send email to
.
Post by Gregory Hnatiuk
Post by aslak hellesoy
Post by Matt Wynne
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google
Groups
Post by Gregory Hnatiuk
Post by aslak hellesoy
"Cukes" group.
To unsubscribe from this group, send email to
.
Post by Gregory Hnatiuk
Post by aslak hellesoy
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups
"Cukes" group.
To unsubscribe from this group, send email to
.
Post by Gregory Hnatiuk
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/cukes?hl=.
--

You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
Loading...