This is sort of a pre-announcement for a Rails plugin my friend Adam Williams and I are working on. We''re in the process of extracting it from a project we are working on so that it can be generally useful to the Rails community. We are calling it "Scenarios". It is a drop in replacement for Rails fixtures: http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/README If you are interested in playing around with it be sure to read through: http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/spec/scenarios_spec.rb And check out the example scenarios in: http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/spec/scenarios/ You will need to be running off of rspec/trunk and probably rails edge as well. More documentation and examples will follow with the official release. -- John Long http://wiseheartdesign.com
On 10/16/07, John W. Long <ws at johnwlong.com> wrote:> This is sort of a pre-announcement for a Rails plugin my friend Adam > Williams and I are working on. We''re in the process of extracting it > from a project we are working on so that it can be generally useful to > the Rails community. We are calling it "Scenarios". It is a drop in > replacement for Rails fixtures: > > http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/README > > If you are interested in playing around with it be sure to read through: > > http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/spec/scenarios_spec.rb > > And check out the example scenarios in: > > http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/spec/scenarios/ > > You will need to be running off of rspec/trunk and probably rails edge as well. > > More documentation and examples will follow with the official release. > > -- > John Long > http://wiseheartdesign.com > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >I would recommend that you rename it, because "Scenario" already has a precise meaning and plays a very important role in RSpec. Pat
Looks good. I recently spent a lot of time looking at something similar before going with the fixtures replacement plugin. It gives me new_user, create_user, create_user(:first_name => ''overriddefault'' ). Also creates records for associations where required. This is useful in story runner, where I''m mocking less. screencast here http://railsnewbie.com/files/fixture_replacement_demo_new.mov - Andy John W. Long-2 wrote:> > This is sort of a pre-announcement for a Rails plugin my friend Adam > Williams and I are working on. We''re in the process of extracting it > from a project we are working on so that it can be generally useful to > the Rails community. We are calling it "Scenarios". It is a drop in > replacement for Rails fixtures: > > http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/README > > If you are interested in playing around with it be sure to read through: > > http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/spec/scenarios_spec.rb > > And check out the example scenarios in: > > http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/spec/scenarios/ > > You will need to be running off of rspec/trunk and probably rails edge as > well. > > More documentation and examples will follow with the official release. > > -- > John Long > http://wiseheartdesign.com > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > >-- View this message in context: http://www.nabble.com/Scenarios-Plugin-Pre-Announcement-tf4637152.html#a13245324 Sent from the rspec-users mailing list archive at Nabble.com.
On 10/16/07, Pat Maddox <pergesu at gmail.com> wrote:> I would recommend that you rename it, because "Scenario" already has a > precise meaning and plays a very important role in RSpec.I can certainly understand why you would say that. The name is inspired by another project mentioned on ErrTheBlog: http://errtheblog.com/post/7708 I''m open to other suggestions. -- John Long http://wiseheartdesign.com
On 10/16/07, Andy Watts <andywatts at yahoo.com> wrote:> I recently spent a lot of time looking at something similar before going > with the fixtures replacement plugin. > It gives me new_user, create_user, create_user(:first_name => > ''overriddefault'' ). > Also creates records for associations where required. This is useful in > story runner, where I''m mocking less. > screencast here > http://railsnewbie.com/files/fixture_replacement_demo_new.movI like the auto generation of those methods. That''s something that we have thought about and intend to add to Scenarios at some point in the future. The huge advantage of Scenarios over the FixtureReplacement plugin (if I understand it correctly) is that it gives you a way to group and manage your record creation calls. So you can say you want to use the Accounts scenario and it will load up your basic accounts, transactions, etc... -- John Long http://wiseheartdesign.com
how about "factory"? or something along that metaphor "assemblies" ... "erections"? maybe not... :) On Oct 17, 2007, at 1:33 AM, John W. Long wrote:> On 10/16/07, Pat Maddox <pergesu at gmail.com> wrote: >> I would recommend that you rename it, because "Scenario" already >> has a >> precise meaning and plays a very important role in RSpec. > > I can certainly understand why you would say that. The name is > inspired by another project mentioned on ErrTheBlog: > > http://errtheblog.com/post/7708 > > I''m open to other suggestions. > > -- > John Long > http://wiseheartdesign.com > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
On Oct 17, 2007, at 1:38 AM, John W. Long wrote:> On 10/16/07, Andy Watts <andywatts at yahoo.com> wrote: >> I recently spent a lot of time looking at something similar before >> going >> with the fixtures replacement plugin. >> It gives me new_user, create_user, create_user(:first_name => >> ''overriddefault'' ). >> Also creates records for associations where required. This is >> useful in >> story runner, where I''m mocking less. >> screencast here >> http://railsnewbie.com/files/fixture_replacement_demo_new.mov > > I like the auto generation of those methods. That''s something that we > have thought about and intend to add to Scenarios at some point in the > future. The huge advantage of Scenarios over the FixtureReplacement > plugin (if I understand it correctly) is that it gives you a way to > group and manage your record creation calls. So you can say you want > to use the Accounts scenario and it will load up your basic accounts, > transactions, etc...I haven''t had the chance to really play with your plugin. How is it different than fixture scenarios (from err.the.blog)? Scott
On 10/17/07, Scott Taylor <mailing_lists at railsnewbie.com> 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
I just updated the README. It gives a better overview of the Scenarios plugin now: http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/README -- John Long http://wiseheartdesign.com
On 10/17/07, John Long <johnwlong2000 at gmail.com> wrote:> I just updated the README. It gives a better overview of the Scenarios > plugin now: > > http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/READMEHas anyone got this to work with Edge Rails/Rspec? I''m getting the following stack trace when I try and execute my specs after installing the plugin: /Users/jknowles/Development/projects/limespot/trunk/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:263:in `load_missing_constant'': uninitialized constant Spec::DSL::ExampleModule (NameError) from /Users/jknowles/Development/projects/limespot/trunk/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:453:in `const_missing'' from /Users/jknowles/Development/projects/limespot/trunk/vendor/plugins/scenarios/lib/scenarios/dsl/extensions.rb:12 from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `require'' from /Users/jknowles/Development/projects/limespot/trunk/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:in `require'' from /Users/jknowles/Development/projects/limespot/trunk/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in'' from /Users/jknowles/Development/projects/limespot/trunk/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:in `require'' from /Users/jknowles/Development/projects/limespot/trunk/vendor/plugins/scenarios/init.rb:4:in `evaluate'' ... 22 levels... from /Users/jknowles/Development/projects/limespot/trunk/vendor/plugins/rspec/lib/spec/runner/options.rb:188:in `each'' from /Users/jknowles/Development/projects/limespot/trunk/vendor/plugins/rspec/lib/spec/runner/options.rb:188:in `load_paths'' from /Users/jknowles/Development/projects/limespot/trunk/vendor/plugins/rspec/lib/spec/runner/command_line.rb:21:in `run'' from /Users/jknowles/Development/projects/limespot/trunk/vendor/plugins/rspec/bin/spec:3
On 10/26/07, Josh Knowles <joshknowles at gmail.com> wrote:> Has anyone got this to work with Edge Rails/Rspec? I''m getting the > following stack trace when I try and execute my specs after installing > the plugin:FYI I got this to work by removing the reference to ExampleModule (lines 12 - 14 of extensions.rb). Great plugin, definitely the best way to manage fixtures that I''ve tried so far.