Forum: RSpec testing out cucumber scenario outline feature

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Joaquin Rivera P. (Guest)
on 2009-02-07 18:59
(Received via mailing list)
hey there,
I've been playing with Scenario Outline according to cucumber wiki. I
have
paste the tests made in http://gist.github.com/59920

the short answers:
http://wiki.github.com/aslakhellesoy/cucumber/scen... seems
inaccurate, Examples should be More Examples. Should I edit the wiki for
you?

when you do:
$ gem install cucumber
you get version 0.1.16, right?  the data in examples does not seem to be
getting to the steps

if you get cucumber vesion 0.1.99.21, then it is webrat who fails with:
`load_missing_constant': uninitialized constant Spec::Runner (NameError)
in:
/webrat-0.4.1/lib/webrat/rspec-rails.rb:8

I am missing something? should I open a ticket on lighthouse?
cheers
joaquin
Joseph W. (Guest)
on 2009-02-07 20:16
(Received via mailing list)
Joaquin Rivera P. wrote:
> hey there,
> I've been playing with Scenario Outline according to cucumber wiki. I
> have paste the tests made in http://gist.github.com/59920
>
> the short answers:
> http://wiki.github.com/aslakhellesoy/cucumber/scen... seems
> inaccurate, Examples should be More Examples. Should I edit the wiki
> for you?

 >Q 1. Is the wiki
http://wiki.github.com/aslakhellesoy/cucumber/scen... not
accurate?

The keyword for scenario outline tables has always been 'Examples'. In
the latest version 0.1.99.* it can also now be 'Scenarios'.
So your example does look like a bug rather than a wiki error.

However the bug has been fixed in the latest version of cucumber 0.1.99
(Which is still in beta) the example works fine:

http://gist.github.com/59939

The github wiki is freely editable by anyone, so if you want to improve
the wiki in the future please do.
>
> when you do:
> $ gem install cucumber
> you get version 0.1.16, right?  the data in examples does not seem to
> be getting to the steps
>
> if you get cucumber vesion 0.1.99.21, then it is webrat who fails with:
> `load_missing_constant': uninitialized constant Spec::Runner (NameError)
> in:
> /webrat-0.4.1/lib/webrat/rspec-rails.rb:8
I've not come across this one before but it looks like its not finding
your Rspec gem/plugin.

--
Joseph W.
http://blog.josephwilk.net
Joaquin Rivera P. (Guest)
on 2009-02-07 22:23
(Received via mailing list)
hey thanks joseph,
I tried this out:
$ ruby script/plugin install git://github.com/dchelimsky/rspec.git -r
'tag
1.1.12'
$ ruby script/plugin install git://github.com/dchelimsky/rspec-rails.git
-r
'tag 1.1.12'

now Webrat finds correctly rspec-rails. Before it was a system gem and
so it
failed, and all my
$ spec spec
were doing fine.

now with Examples as the keyword everything runs fine.

$ cucumber features/manage_cukes.feature
Feature: Manage cukes
  In order to use scenario outlines
  everything should work

  Scenario Outline: Testing scenario outlines #
features/manage_cukes.feature:5
    Given there are <cuke_versions>

  Examples:
    | cuke_versions  |
    | cuke_version 1 |
    | cuke_version 2 |
    | cuke_version 3 |
    | cuke_version 4 |

4 scenarios
4 undefined steps

You can implement step definitions for missing steps with these
snippets:

Given /^there are cuke_version 1$/ do
  pending
end

Given /^there are cuke_version 2$/ do
  pending
end

Given /^there are cuke_version 3$/ do
  pending
end

Given /^there are cuke_version 4$/ do
  pending
end

the thing was I was expecting the step like this:

Given /^there are <cuke_versions>$/ do
  cuke_version.should_not be_nil
end

and then the step get called 4 times with the right data each time. But
the
wiki states "*IMPORTANT: Your step definitions will never have to match
a
placeholder. They will need to match the values that will replace the
placeholder*" so its a feature.

Then I must be missing the purpose of it. I'll dive the code and see...

thanks
joaquin
This topic is locked and can not be replied to.