Chiyuan Zhang
2007-Dec-31 10:55 UTC
[rspec-users] How to run stories with `spec'' command?
Hi, all! I have a story steps array.rb and the story array.story. I can run it with ruby array.rb But when I execute spec array.rb nothing happened. I''m wondering how can I use spec command to execute stories? (executing examples is OK) Or maybe another question. If I have to run stories with `ruby'' command, how can I choose the output format? (I think there''s only plain text and HTML for stories currently) Any idea? Thanks. ps: Here''s my stories ===========array.rb ===========require ''spec/story'' steps_for(:array) do Given("my state initialized") do @array = Array.new end When("$elem added to me") do |elem| @array << elem end Then("my size should be $size") do |size| @array.size.should == size.to_i end end # if __FILE__ == $0 with_steps_for :array do run __FILE__.gsub(/\.rb$/, ''.story'') end # end ==========array.story ==========Story: array for holding objects As an array for holding objects I can hold a bunch of objects So that they can be retrieved later Scenario: an empty array Given my state initialized Then my size should be 0 Scenario: an array with only 1 element Given my state initialized When 1 added to me Then my size should be 1
aslak hellesoy
2007-Dec-31 13:19 UTC
[rspec-users] How to run stories with `spec'' command?
On Dec 31, 2007 11:55 AM, Chiyuan Zhang <pluskid at gmail.com> wrote:> Hi, all! > > I have a story steps array.rb and the story array.story. I > can run it with > > ruby array.rb > > But when I execute > > spec array.rb > > nothing happened. I''m wondering how can I use spec command to > execute stories?You can''t. The spec command is only for examples. Aslak> (executing examples is OK) Or maybe another > question. If I have to run stories with `ruby'' command, how > can I choose the output format? (I think there''s only plain text > and HTML for stories currently) Any idea? Thanks. > > ps: Here''s my stories > > ===========> array.rb > ===========> require ''spec/story'' > > steps_for(:array) do > Given("my state initialized") do > @array = Array.new > end > When("$elem added to me") do |elem| > @array << elem > end > Then("my size should be $size") do |size| > @array.size.should == size.to_i > end > end > > # if __FILE__ == $0 > with_steps_for :array do > run __FILE__.gsub(/\.rb$/, ''.story'') > end > # end > > ==========> array.story > ==========> Story: array for holding objects > As an array for holding objects > I can hold a bunch of objects > So that they can be retrieved later > > Scenario: an empty array > Given my state initialized > Then my size should be 0 > > Scenario: an array with only 1 element > Given my state initialized > When 1 added to me > Then my size should be 1 > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Dec 31, 2007, at 5:55 AM, Chiyuan Zhang wrote:> Hi, all! > > I have a story steps array.rb and the story array.story. I > can run it with > > ruby array.rb > > But when I execute > > spec array.rb > > nothing happened. I''m wondering how can I use spec command to > execute stories? (executing examples is OK) Or maybe another > question. If I have to run stories with `ruby'' command, how > can I choose the output format? (I think there''s only plain text > and HTML for stories currently) Any idea? Thanks. >Here is something I''m playing around with: http://smartic.us/2007/12/22/smarticus-rspec-stories-on-rails Plus Bryan Helkamp mentioned something as well a couple of days ago. Good luck!
Chiyuan Zhang
2008-Jan-01 02:22 UTC
[rspec-users] How to run stories with `spec'' command?
Hmm, Thanks for your suggestion. I suppose the document of stories for rspec is not complete yet? Maybe the file layout suggestion could be included in the document. ps: Happy New Year to all! 2008/1/1, Bryan Liles <bryan at osesm.com>:> > On Dec 31, 2007, at 5:55 AM, Chiyuan Zhang wrote: > > > Hi, all! > > > > I have a story steps array.rb and the story array.story. I > > can run it with > > > > ruby array.rb > > > > But when I execute > > > > spec array.rb > > > > nothing happened. I''m wondering how can I use spec command to > > execute stories? (executing examples is OK) Or maybe another > > question. If I have to run stories with `ruby'' command, how > > can I choose the output format? (I think there''s only plain text > > and HTML for stories currently) Any idea? Thanks. > > > > Here is something I''m playing around with: > > http://smartic.us/2007/12/22/smarticus-rspec-stories-on-rails > > Plus Bryan Helkamp mentioned something as well a couple of days ago. > > Good luck! > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Dec 31, 2007, at 9:22 PM, Chiyuan Zhang wrote:> Hmm, Thanks for your suggestion. I suppose the document of stories > for rspec is not complete yet? Maybe the file layout suggestion could > be included in the document. > > ps: Happy New Year to all!Stories are still a moving target. I was suggesting one possibility, but I do believe that Bryan H''s idea has merit as well, and I may include parts of his in my ultimate solution (while the jury is still out on official rspec endorsed method)