Is there any way to nest scenarios in steak? (or any other way of nesting)?

48 views
Skip to first unread message

David Kahn

unread,
Dec 16, 2010, 2:15:04 PM12/16/10
to ste...@googlegroups.com
For example, is there any way to achieve something like this in Steak, or are we limited to scenario by scenario (AFAIK the way Cucumber works)?

  scenario "users should be able to authenticate and redirect properly" do
 
    scenario "be albe to log in and log out" do

    end
 
    scenario "not be able to access system with missing or incomplete login info" do

    end
   
  end

Jaime Iniesta

unread,
Dec 16, 2010, 2:22:09 PM12/16/10
to ste...@googlegroups.com
Yes, you can use contexts, like:

context "Anonymous user" do
  scenario "should not see posts" do
    ...
  end
 
  scenario "should not see new post form" do
    ...
  end
end

context "Logged in user" do
  before(:each) do
    user_login
  end

  after(:each) do
    user_logout
  end

  scenario "should see posts" do
    ...
  end

  scenario "should see new post form" do
    ...
  end
end  


2010/12/16 David Kahn <d...@structuralartistry.com>

David Kahn

unread,
Dec 16, 2010, 2:28:59 PM12/16/10
to ste...@googlegroups.com
On Thu, Dec 16, 2010 at 1:22 PM, Jaime Iniesta <jaimei...@gmail.com> wrote:
Yes, you can use contexts, like:

context "Anonymous user" do
  scenario "should not see posts" do
    ...
  end
 
  scenario "should not see new post form" do
    ...
  end
end

Ah, nice, thanks! That also makes Steak more appealing than Cucumber, am I correct you cant do this in Cukes?
 

Jaime Iniesta

unread,
Dec 16, 2010, 2:43:53 PM12/16/10
to ste...@googlegroups.com


2010/12/16 David Kahn <d...@structuralartistry.com>



On Thu, Dec 16, 2010 at 1:22 PM, Jaime Iniesta <jaimei...@gmail.com> wrote:
Yes, you can use contexts, like:

context "Anonymous user" do
  scenario "should not see posts" do
    ...
  end
 
  scenario "should not see new post form" do
    ...
  end
end

Ah, nice, thanks! That also makes Steak more appealing than Cucumber, am I correct you cant do this in Cukes?

"context" comes from RSpec itself.

The beauty of Steak is that it's nothing more than a few aliases, look at the source:


So you could use directly RSpec, defining the aliases you want, but Steak makes it cleaner, comes with a good generator, and has a good name :) 

David Kahn

unread,
Dec 16, 2010, 3:09:56 PM12/16/10
to ste...@googlegroups.com

Very nice... I am so over step defs. I thought about and did a POC using Capybara in Test/Unit but now I see I get a lot by staying in Rspec and adding Steak.

Reply all
Reply to author
Forward
0 new messages