Displaying 12 results from an estimated 12 matches for "with_steps_for".
2008 May 02
2
Return code for running stories
...t the code or
tests). It would be nice to put the script
that runs the stories as a pre-commit hook, preventing the commit
from succeeding if the stories fail.
For that, I need to set the right exit code.
In turn, I need to know he result of the tests.
Given the prescription of running stories:
with_steps_for :accounts do
run ''path/to/file/with/story''
end
I see neither #with_steps_for, nor #run return anything resembling
the result of the tests (which does not really surprise me).
So how to get the success/pending/failure of the stories out?
Should I write a formatter/listener t...
2008 Mar 20
5
sharing story steps
Hi,
How can I have a common set of steps that all my stories share?
i.e. My stories often start out looking like this:
Given a user Joe
Given a user Jordan
then:
Given("a user $username") do |username|
@users ||= {}
@user_sessions ||= {}
@users[username] = create_user(:username => username)
@user_sessions[username] = login_as(@users[username])
end
I want to share that
2008 Jan 14
6
RSpec stories introduction
...rties entry is added for job and client with type "bill"
And job_parties status is set to "quote"
Scenario: client is held for administrative approval
...
<---
I infer that I should also create a file called new_job.rb in stories and
that it should contain:
--->
with_steps_for :new_jobs_steps do
run ''./new_job.txt''
end
<---
Then I believe that I require yet another file called "new_job_steps.rb"
that has code that looks somewhat like this:
--->
steps_for(:new_job_steps) do
Given "client exists in database" do
Client.d...
2007 Nov 14
5
ETA to Stories
Hey guys, just poppin in to ask if anyone knows when stories will be
somewhat stable? We''re starting to use integration tests at work,
we''re already using rspec, and I''d like to avoid integration tests if
possible.
Thanks,
Nate "fowlduck" Sutton
2007 Dec 31
4
How to run stories with `spec'' command?
...39;
steps_for(:array) do
Given("my state initialized") do
@array = Array.new
end
When("$elem added to me") do |elem|
@array << elem
end
Then("my size should be $size") do |size|
@array.size.should == size.to_i
end
end
# if __FILE__ == $0
with_steps_for :array do
run __FILE__.gsub(/\.rb$/, ''.story'')
end
# end
===========
array.story
===========
Story: array for holding objects
As an array for holding objects
I can hold a bunch of objects
So that they can be retrieved later
Scenario: an empty array
Given my state i...
2008 Jan 16
1
session data and user stories
....should == {:id => 1, "flash" => {}}
end
#and this is just hideous.
Then("I should be sent to the dealer landing page") do
puts @session.response.instance_variable_get("@redirected_to").should
== {:controller => "dealers"}
end
end
with_steps_for(:dealer_login) do
run_local_story "dealer_story", :type=>RailsStory
end
there is a good chance someone has already covered this and i have just
managed to miss it. documentation on rbehave is sparse (at best, as i have
seen it. i have the peepcode, but if anyone has any other good...
2008 May 30
4
RSpec Post/Get and Sessions in a Story
I''ve got an RSpec story that reads like:
-------------------------------------------------------------------
Given that a post exists
And I am logged in
And I have edit permissions
When I visit the post details page
Then there should be a link to add a new comment
-------------------------------------------------------------------
The issue I''m having is that I can''t
2007 Dec 21
4
StoryRunner docs/guidance
Hi all,
Are there any plans for better documentation for the new StoryRunner
feature? I tried to use it today (with Rails), and had a hard time
getting my head around whether I was doing it "right" and exactly what
things are appropriate to test at that level (this might be exacerbated
by the fact that I''ve never really used integration testing that much).
A full example of
2008 Jun 17
1
Confused - which is the correct Story API
...r
I want to buy something
So I have stuff
Scenario: user has money and buys something
Given a user has 100 dollars
etc...
-- Ruby file mystory.rb --
require File.join(File.dirname(__FILE__), "spec_helper")
steps_for(:my_steps) do
Given...
When...
Then...
etc...
end
with_steps_for :my_steps do
run File.expand_path(__FILE__).gsub(".rb",".story")
end
Now for the non-plain text stories is it this? (splitting into
separate files is a YMMV thing)
--- mystory.rb ---
require File.join(File.dirname(__FILE__), "spec_helper")
steps_for(:my_steps) do...
2008 Jun 09
6
Selenium/Watir usage along side Webrat in story testing
...''m logged in'') do
visits ''/login''
fills_in ''username'' ''test''
fills_in ''password'' ''password''
clicks ''login''
end
end
#Make webrat syntax work with selenium
with_steps_for(:login) do
run ''/example/story'', {:type => RailsSeleniumStory}
end
#Use Webrat
with_steps_for(:login) do
run ''/example/story'', {:type => RailsWebratStory} #Could just be
RailsStory
end
class RailsSeleniumStory < RailsStory
...
#Map webrats...
2007 Dec 29
5
./script/story command
...st.gsub(/^# steps: /, "").split(",").map(&:strip)
else
story_name.to_s.split("/")
end
end
def run_story(lines, steps)
tempfile = Tempfile.new("story")
lines.each do |line|
tempfile.puts line
end
tempfile.close
with_steps_for(*steps.map(&:to_sym)) do
run tempfile.path, :type => RailsStory
end
end
end
StoryCommand.run
2008 Jun 14
15
Reusing story snippets
I find myself doing this:
Scenario "logged in user visiting the home page" do
Given "A logged in user" do
a_logged_in_user
end
When "..."
Then "..."
end
The a_logged_in_user method is a helper method in helper.rb which sets
up the state so that the user can browse the website.
Later in the story of course, I can just do ''Given