On 10/17/07, Scott Taylor <[EMAIL PROTECTED]> wrote: > I haven't had the chance to really play with your plugin. How is it > different than fixture scenarios (from err.the.blog)?
I haven't actually used err.the.blog's plugin, though ours certainly draws heavily upon it for inspiration. >From what I can tell both plugins provide the following: 1. Code based data population 2. Grouping of data population methods through "scenarios" 3. Dependencies between scenarios so that you can declare that one scenario requires another to be loaded first One key difference between the two plugins is that err.the.blog's approach depends on your models being in place and creates new records using your models. This means that your scenario data must run through validations before it can be inserted into the database. This can be slow. Our approach encourages you to inject data straight into the database in much the same way that fixtures do it. We believe this is a better approach. One thing that our approach adds over err.the.blog's is the idea of Scenario helpers. To use scenario helpers you declare them inside a Scenario: class PeopleScenario < Scenario::Base def load create_person :name => "John" end helpers do def create_person(attributes={}) create_record :person, attributes[:name].downcase.intern, attributes end def login_as(person) # insert person into session end end end Helper methods declared inside the helpers block are mixed into the scenario (so you can access them in the load method) and into the Rspec behavior: describe "Projects screen" do scenario :people it "should show active projects" do login_as(people(:john)) # verify that the correct projects are showing end end For more examples I'd highly encourage you to look through the specs: http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/spec/scenarios_spec.rb -- John Long http://wiseheartdesign.com _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users