[LRUG] parametise and pass values to a story

Murray Steele murray.steele at gmail.com
Tue May 27 05:22:33 PDT 2008


2008/5/27 aidy lewis <aidy.lewis at googlemail.com>:

> Hi,
>
> Could anyone please tell me how I can parametise and pass values to this
> story?
>

How about?

[:chese, :monkey, :dragon].each do |special_site|
  Story "Login to #{special_site} site",
    %(As an #{special_site} user I want to login to my site to view
available content) do

Scenario "The user inputs a correct username and login \n" do
>   Given "the username and the password is correct" do
>     @browser_wrapper = BrowserWrapper.new


@its_not_important_what_this_is_called =
"#{special_site.to_s.capitalize}Website".constantize.new(@browser_wrapper.browser)

    puts "probably need to abstract these to a setup method"


@browser_wrapper.goto("http://#{special_site}.ui.systest<http://xxx.ui.systest>
")

   end
>    When "the user submits the login form" do


@its_not_important_what_this_is_called.welcome_page.login("foo", "bar")

    end
>   end
>  end
>

Of course, that might not really be what you meant (and also might not
work).  Also worth noting is that the .constantize bit means you need
activesupport - but there would be an easy way to do it without that
requirement; I'm just lazy.

Muz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20080527/a5b32eae/attachment.html>


More information about the Chat mailing list