[rspec-users] how to set up data before story runner steps?
dchelimsky at gmail.com
Wed Feb 27 00:31:32 EST 2008
On Tue, Feb 26, 2008 at 10:53 PM, Bei <libei.twer at gmail.com> wrote:
> I'm using story runner of RSpec now. What I'm trying to do is
> initializing the @selenium before any steps of one story is executing,
> and stop @selenium after any story is finished. just as @BeforeClass
> and @AfterClass in jUnit
> Any suggestions on this?
There is no way built in to handle this yet. Is anybody doing this yet?
If not, you'll have to experiment. If you're interested, I think the
way to handle it is to register a listener like this:
The listener object should receive messages like run_started,
story_started, scenario_started and story_ended, run_ended and
scenario_failed or scenario_pending.
Be sure to implement method_missing to ignore everything else.
Good luck, and let us know what works.
> here is my code for
> steps_for(:search) do
> Given("user could access search page") do
> @google_page = GooglePage.new(@selenium)
> Given("user enter search test: $search_text") do |$search_text|
> When("do search") do
> @search_result_page = @google_page.search
> Then("show search result") do
> @search_result_page.should_not == nil
> Story: #000
> As A command human
> I want to get information quickly
> So that I could save me time on doing real things
> Scenario: could search
> Given user could access search page
> And user enter search test: asdfasdfasdfas
> When do search
> Then show search result
> with_steps_for :search do
> run 'stories/000.story'
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users