[rspec-devel] [ rspec-Feature Requests-12628 ] Integrate rbehave into rspec

noreply at rubyforge.org noreply at rubyforge.org
Sat Jul 28 07:14:14 EDT 2007


Feature Requests item #12628, was opened at 2007-07-27 12:33
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=12628&group_id=797

Category: None
Group: None
Status: Open
Priority: 3
Submitted By: Dan North (tastapod)
Assigned to: Nobody (None)
Summary: Integrate rbehave into rspec

Initial Comment:
rbehave is a story/scenario description framework that describes behaviour for an application in the same way that rspec describes behaviour for objects.

It would make sense for rspec to contain rbehave in a "story" module (spec/story) so that rspec becomes a "full stack" BDD framework.

This initial feature request is simply to bring rbehave into the rspec project. Further work (ie. further feature requests) would create closer integration between the two, and providing a way to describe Rails behaviour at a story/scenario level.

----------------------------------------------------------------------

Comment By: Michael Klishin (michaelklishin)
Date: 2007-07-28 11:14

Message:
RBehave is great, plus one for it. The only problem is that it is poorly documented. And yes, I'd like to submit a patch when I get deep enough in the source.

----------------------------------------------------------------------

Comment By: Yurii Rashkovskii (yrashk)
Date: 2007-07-28 10:59

Message:
First of all, thank you for your nice DSL

Then, here is a draft version of code that isolates scenarios into ActiveRecord transactions (extract from my project)

class ActiveRecordSafetyListener
  include Singleton
  def scenario_started(*args)
    unless Rails::VERSION::STRING == "1.1.6"
      ActiveRecord::Base.send :increment_open_transactions
    end
    ActiveRecord::Base.connection.begin_db_transaction
  end
  def scenario_succeeded(*args)
    ActiveRecord::Base.connection.rollback_db_transaction
    unless Rails::VERSION::STRING == "1.1.6"
      ActiveRecord::Base.send :decrement_open_transactions
    end
  end
  alias :scenario_pending :scenario_succeeded
  alias :scenario_failed :scenario_succeeded
end


class RBehave::Runner::ScenarioRunner
  def initialize
    @listeners = [ActiveRecordSafetyListener.instance]
  end
end



----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=12628&group_id=797


More information about the rspec-devel mailing list