Hi, I''ve been following this thread and I can get the example stories to run with the ruby command. But I''ve been unable to get the example from http://blog.davidchelimsky.net/articles/2007/10/25/plain-text-stories-part-iii to run with all.rb ruby stories/all.rb /home/edh/story/stories/additions/steps/addition_steps.rb:2: undefined method `steps_for'' for main:Object (NoMethodError) from /home/edh/story/stories/all.rb:3:in `require'' from /home/edh/story/stories/all.rb:3 from /home/edh/story/stories/all.rb:2:in `each'' from /home/edh/story/stories/all.rb:2 from stories/all.rb:3:in `require'' from stories/all.rb:3 from stories/all.rb:2:in `each'' from stories/all.rb:2 The examples seem older than the version on David''s blog. Am I missing some parts from David''s blog? My directory looks like: stories/ |-- additions | |-- adder.rb | |-- addition | |-- addition.rb | `-- steps | `-- addition_steps.rb |-- all.rb `-- helper.rb If I run the story stand-alone, I get: ruby stories/additions/addition.rb Running 2 scenarios: Story: simple addition As an accountant I want to add numbers So that I can count beans Scenario: add one plus one Given an addend of 1 (PENDING) And an addend of 1 (PENDING) When the addends are added (PENDING) Then the sum should be 2 (PENDING) And the corks should be popped/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/sqlite3/errors.rb:94:in `check'': SQL logic error or missing database (SQLite3::SQLException) from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/sqlite3/resultset.rb:76:in `check'' from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/sqlite3/resultset.rb:68:in `commence'' from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/sqlite3/resultset.rb:61:in `initialize'' from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/sqlite3/statement.rb:163:in `new'' from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/sqlite3/statement.rb:163:in `execute'' from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/sqlite3/database.rb:212:in `execute'' from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/sqlite3/database.rb:187:in `prepare'' from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/sqlite3/database.rb:211:in `execute'' ... 13 levels... from /home/edh/story/vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:39:in `each'' from /home/edh/story/vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:39:in `run_stories'' from /home/edh/story/vendor/plugins/rspec/lib/spec/story/runner.rb:41:in `register_exit_hook'' from stories/additions/addition.rb:3 This last part is happening in the at_exit part of Test:Unit Also, I don''t understand why the scenario''s are pending. Thanks Ed -- Ed Howland http://greenprogrammer.blogspot.com "The information transmitted is intended only for the person or entity to which it is addressed and may contain proprietary, confidential and/or legally privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers."
When I copied the addition example into my test rails app, things worked... The "popping the cork" was the only pending action, and was expected. I''ve only be able to run via ruby as well. Eric On Nov 15, 2007, at 11:56 AM, Ed Howland wrote:> Hi, I''ve been following this thread and I can get the example stories > to run with the ruby command. But I''ve been unable to get the example > from http://blog.davidchelimsky.net/articles/2007/10/25/plain-text- > stories-part-iii > to run with all.rb > > > ruby stories/all.rb > /home/edh/story/stories/additions/steps/addition_steps.rb:2: undefined > method `steps_for'' for main:Object (NoMethodError) > from /home/edh/story/stories/all.rb:3:in `require'' > from /home/edh/story/stories/all.rb:3 > from /home/edh/story/stories/all.rb:2:in `each'' > from /home/edh/story/stories/all.rb:2 > from stories/all.rb:3:in `require'' > from stories/all.rb:3 > from stories/all.rb:2:in `each'' > from stories/all.rb:2 > > The examples seem older than the version on David''s blog. Am I missing > some parts from David''s blog? > > My directory looks like: > stories/ > |-- additions > | |-- adder.rb > | |-- addition > | |-- addition.rb > | `-- steps > | `-- addition_steps.rb > |-- all.rb > `-- helper.rb > > If I run the story stand-alone, I get: > ruby stories/additions/addition.rb > Running 2 scenarios: > > Story: simple addition > > As an accountant > I want to add numbers > So that I can count beans > > Scenario: add one plus one > > Given an addend of 1 (PENDING) > And an addend of 1 (PENDING) > > When the addends are added (PENDING) > > Then the sum should be 2 (PENDING) > And the corks should be > popped/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/ > sqlite3/errors.rb:94:in > `check'': SQL logic error or missing database (SQLite3::SQLException) > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/resultset.rb:76:in > `check'' > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/resultset.rb:68:in > `commence'' > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/resultset.rb:61:in > `initialize'' > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/statement.rb:163:in > `new'' > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/statement.rb:163:in > `execute'' > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/database.rb:212:in > `execute'' > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/database.rb:187:in > `prepare'' > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > lib/sqlite3/database.rb:211:in > `execute'' > ... 13 levels... > from /home/edh/story/vendor/plugins/rspec/lib/spec/story/ > runner/story_runner.rb:39:in > `each'' > from /home/edh/story/vendor/plugins/rspec/lib/spec/story/ > runner/story_runner.rb:39:in > `run_stories'' > from /home/edh/story/vendor/plugins/rspec/lib/spec/story/ > runner.rb:41:in > `register_exit_hook'' > from stories/additions/addition.rb:3 > This last part is happening in the at_exit part of Test:Unit > > Also, I don''t understand why the scenario''s are pending. > > Thanks > Ed > > > > -- > Ed Howland > http://greenprogrammer.blogspot.com > "The information transmitted is intended only for the person or entity > to which it is addressed and may contain proprietary, confidential > and/or legally privileged material. Any review, retransmission, > dissemination or other use of, or taking of any action in reliance > upon, this information by persons or entities other than the intended > recipient is prohibited. If you received this in error, please contact > the sender and delete the material from all computers." > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users----------------------------------------------------- Eric Pugh | Principal | OpenSource Connections, LLC | 434.466.1467 | http://www.opensourceconnections.com
Yeah, I got the stand-alone story to work. The trick was to mv stories/additions/steps to stories/steps. My stories/helper.rb looks like this: ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require ''spec/rails/story_adapter'' Dir[File.join(File.dirname(__FILE__), "steps/*.rb")].each do |file| require file end I personally think that steps should be isolated from other stories. This seems to requre all steps in every story. all.rb is still giving me the same error. Ed On Nov 15, 2007 12:19 PM, Eric Pugh <epugh at opensourceconnections.com> wrote:> When I copied the addition example into my test rails app, thing > worked... The "popping the cork" was the only pending action, and > was expected. I''ve only be able to run via ruby as well. > > Eric > > > > > On Nov 15, 2007, at 11:56 AM, Ed Howland wrote: > > > Hi, I''ve been following this thread and I can get the example stories > > to run with the ruby command. But I''ve been unable to get the example > > from http://blog.davidchelimsky.net/articles/2007/10/25/plain-text- > > stories-part-iii > > to run with all.rb > > > > > > ruby stories/all.rb > > /home/edh/story/stories/additions/steps/addition_steps.rb:2: undefined > > method `steps_for'' for main:Object (NoMethodError) > > from /home/edh/story/stories/all.rb:3:in `require'' > > from /home/edh/story/stories/all.rb:3 > > from /home/edh/story/stories/all.rb:2:in `each'' > > from /home/edh/story/stories/all.rb:2 > > from stories/all.rb:3:in `require'' > > from stories/all.rb:3 > > from stories/all.rb:2:in `each'' > > from stories/all.rb:2 > > > > The examples seem older than the version on David''s blog. Am I missing > > some parts from David''s blog? > > > > My directory looks like: > > stories/ > > |-- additions > > | |-- adder.rb > > | |-- addition > > | |-- addition.rb > > | `-- steps > > | `-- addition_steps.rb > > |-- all.rb > > `-- helper.rb > > > > If I run the story stand-alone, I get: > > ruby stories/additions/addition.rb > > Running 2 scenarios: > > > > Story: simple addition > > > > As an accountant > > I want to add numbers > > So that I can count beans > > > > Scenario: add one plus one > > > > Given an addend of 1 (PENDING) > > And an addend of 1 (PENDING) > > > > When the addends are added (PENDING) > > > > Then the sum should be 2 (PENDING) > > And the corks should be > > popped/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/ > > sqlite3/errors.rb:94:in > > `check'': SQL logic error or missing database (SQLite3::SQLException) > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > lib/sqlite3/resultset.rb:76:in > > `check'' > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > lib/sqlite3/resultset.rb:68:in > > `commence'' > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > lib/sqlite3/resultset.rb:61:in > > `initialize'' > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > lib/sqlite3/statement.rb:163:in > > `new'' > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > lib/sqlite3/statement.rb:163:in > > `execute'' > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > lib/sqlite3/database.rb:212:in > > `execute'' > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > lib/sqlite3/database.rb:187:in > > `prepare'' > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > lib/sqlite3/database.rb:211:in > > `execute'' > > ... 13 levels... > > from /home/edh/story/vendor/plugins/rspec/lib/spec/story/ > > runner/story_runner.rb:39:in > > `each'' > > from /home/edh/story/vendor/plugins/rspec/lib/spec/story/ > > runner/story_runner.rb:39:in > > `run_stories'' > > from /home/edh/story/vendor/plugins/rspec/lib/spec/story/ > > runner.rb:41:in > > `register_exit_hook'' > > from stories/additions/addition.rb:3 > > This last part is happening in the at_exit part of Test:Unit > > > > Also, I don''t understand why the scenario''s are pending. > > > > Thanks > > Ed > > > > > > > > -- > > Ed Howland > > http://greenprogrammer.blogspot.com > > "The information transmitted is intended only for the person or entity > > to which it is addressed and may contain proprietary, confidential > > and/or legally privileged material. Any review, retransmission, > > dissemination or other use of, or taking of any action in reliance > > upon, this information by persons or entities other than the intended > > recipient is prohibited. If you received this in error, please contact > > the sender and delete the material from all computers." > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > ----------------------------------------------------- > Eric Pugh | Principal | OpenSource Connections, LLC | 434.466.1467 | > http://www.opensourceconnections.com > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Ed Howland http://greenprogrammer.blogspot.com "The information transmitted is intended only for the person or entity to which it is addressed and may contain proprietary, confidential and/or legally privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers."
On Nov 15, 2007 12:26 PM, Ed Howland <ed.howland at gmail.com> wrote:> Yeah, I got the stand-alone story to work. The trick was to mv > stories/additions/steps to stories/steps. My stories/helper.rb > looks like this: > > ENV["RAILS_ENV"] = "test" > require File.expand_path(File.dirname(__FILE__) + "/../config/environment") > require ''spec/rails/story_adapter'' > Dir[File.join(File.dirname(__FILE__), "steps/*.rb")].each do |file| > require file > end > > I personally think that steps should be isolated from other stories. > This seems to requre all steps in every story.It requires them all but doesn''t expose them all in your story. Agreed that each story should be limited in what it sees.> > all.rb is still giving me the same error. > > Ed > > > On Nov 15, 2007 12:19 PM, Eric Pugh <epugh at opensourceconnections.com> wrote: > > When I copied the addition example into my test rails app, thing > > > worked... The "popping the cork" was the only pending action, and > > was expected. I''ve only be able to run via ruby as well. > > > > Eric > > > > > > > > > > On Nov 15, 2007, at 11:56 AM, Ed Howland wrote: > > > > > Hi, I''ve been following this thread and I can get the example stories > > > to run with the ruby command. But I''ve been unable to get the example > > > from http://blog.davidchelimsky.net/articles/2007/10/25/plain-text- > > > stories-part-iii > > > to run with all.rb > > > > > > > > > ruby stories/all.rb > > > /home/edh/story/stories/additions/steps/addition_steps.rb:2: undefined > > > method `steps_for'' for main:Object (NoMethodError) > > > from /home/edh/story/stories/all.rb:3:in `require'' > > > from /home/edh/story/stories/all.rb:3 > > > from /home/edh/story/stories/all.rb:2:in `each'' > > > from /home/edh/story/stories/all.rb:2 > > > from stories/all.rb:3:in `require'' > > > from stories/all.rb:3 > > > from stories/all.rb:2:in `each'' > > > from stories/all.rb:2 > > > > > > The examples seem older than the version on David''s blog. Am I missing > > > some parts from David''s blog? > > > > > > My directory looks like: > > > stories/ > > > |-- additions > > > | |-- adder.rb > > > | |-- addition > > > | |-- addition.rb > > > | `-- steps > > > | `-- addition_steps.rb > > > |-- all.rb > > > `-- helper.rb > > > > > > If I run the story stand-alone, I get: > > > ruby stories/additions/addition.rb > > > Running 2 scenarios: > > > > > > Story: simple addition > > > > > > As an accountant > > > I want to add numbers > > > So that I can count beans > > > > > > Scenario: add one plus one > > > > > > Given an addend of 1 (PENDING) > > > And an addend of 1 (PENDING) > > > > > > When the addends are added (PENDING) > > > > > > Then the sum should be 2 (PENDING) > > > And the corks should be > > > popped/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/lib/ > > > sqlite3/errors.rb:94:in > > > `check'': SQL logic error or missing database (SQLite3::SQLException) > > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > > lib/sqlite3/resultset.rb:76:in > > > `check'' > > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > > lib/sqlite3/resultset.rb:68:in > > > `commence'' > > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > > lib/sqlite3/resultset.rb:61:in > > > `initialize'' > > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > > lib/sqlite3/statement.rb:163:in > > > `new'' > > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > > lib/sqlite3/statement.rb:163:in > > > `execute'' > > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > > lib/sqlite3/database.rb:212:in > > > `execute'' > > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > > lib/sqlite3/database.rb:187:in > > > `prepare'' > > > from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ > > > lib/sqlite3/database.rb:211:in > > > `execute'' > > > ... 13 levels... > > > from /home/edh/story/vendor/plugins/rspec/lib/spec/story/ > > > runner/story_runner.rb:39:in > > > `each'' > > > from /home/edh/story/vendor/plugins/rspec/lib/spec/story/ > > > runner/story_runner.rb:39:in > > > `run_stories'' > > > from /home/edh/story/vendor/plugins/rspec/lib/spec/story/ > > > runner.rb:41:in > > > `register_exit_hook'' > > > from stories/additions/addition.rb:3 > > > This last part is happening in the at_exit part of Test:Unit > > > > > > Also, I don''t understand why the scenario''s are pending. > > > > > > Thanks > > > Ed > > > > > > > > > > > > -- > > > Ed Howland > > > http://greenprogrammer.blogspot.com > > > "The information transmitted is intended only for the person or entity > > > to which it is addressed and may contain proprietary, confidential > > > and/or legally privileged material. Any review, retransmission, > > > dissemination or other use of, or taking of any action in reliance > > > upon, this information by persons or entities other than the intended > > > recipient is prohibited. If you received this in error, please contact > > > the sender and delete the material from all computers." > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > ----------------------------------------------------- > > Eric Pugh | Principal | OpenSource Connections, LLC | 434.466.1467 | > > http://www.opensourceconnections.com > > > > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > -- > Ed Howland > http://greenprogrammer.blogspot.com > "The information transmitted is intended only for the person or entity > to which it is addressed and may contain proprietary, confidential > and/or legally privileged material. Any review, retransmission, > dissemination or other use of, or taking of any action in reliance > upon, this information by persons or entities other than the intended > recipient is prohibited. If you received this in error, please contact > the sender and delete the material from all computers." > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Nov 15, 2007 12:30 PM, David Chelimsky <dchelimsky at gmail.com> wrote:> > ENV["RAILS_ENV"] = "test" > > require File.expand_path(File.dirname(__FILE__) + "/../config/environment") > > require ''spec/rails/story_adapter'' > > Dir[File.join(File.dirname(__FILE__), "steps/*.rb")].each do |file| > > require file > > end > > > > I personally think that steps should be isolated from other stories. > > This seems to requre all steps in every story. > > It requires them all but doesn''t expose them all in your story. Agreed > that each story should be limited in what it sees.David, Thanks for the info. Any directions you can point me to make : ruby stories/all.rb work? I think I am missing some require there. It is the stock one from trunk. Thanks Ed
On Nov 15, 2007 1:00 PM, Ed Howland <ed.howland at gmail.com> wrote:> On Nov 15, 2007 12:30 PM, David Chelimsky <dchelimsky at gmail.com> wrote: > > > ENV["RAILS_ENV"] = "test" > > > require File.expand_path(File.dirname(__FILE__) + "/../config/environment") > > > require ''spec/rails/story_adapter'' > > > Dir[File.join(File.dirname(__FILE__), "steps/*.rb")].each do |file| > > > require file > > > end > > > > > > I personally think that steps should be isolated from other stories. > > > This seems to requre all steps in every story. > > > > It requires them all but doesn''t expose them all in your story. Agreed > > that each story should be limited in what it sees. > > David, > > Thanks for the info. Any directions you can point me to make : > > ruby stories/all.rb > > work? I think I am missing some require there. It is the stock one from trunk.The one that gets generated by script/generate rspec should just work. It requires every ruby file in the stories directory and any of its subdirectories. As long as each file is also doing the requiring that it needs (i.e. each file that runs specific stories requires stories/helper.rb and helper.rb requires all the step definitions) you should be fine. David> > Thanks > Ed > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >