Hi, I am very new to Ruby and Rspec, and found a simple tutorial online about rspec. It involves two files: bowling.rb and bowling_spec.rb # bowling_spec.rb require''rubygems'' require ''spec'' require ''bowling'' describe Bowling do it "should score 0 for gutter game" do bowling = Bowling.new 20.times { bowling.hit(0) } bowling.score.should == 0 end end #bowling.rb class Bowling def hit(pins) end def score 1 end end When I run the spec, I expect to see some sort of output along these lines: "Bowling should score 0 for gutter game". When I run it (from text mate) there are no errors, and there is no output. I see the same result running it from the command line. Am I doing something wrong? Thanks, Beccy -- View this message in context: http://old.nabble.com/Running-simple-rspec%2C-no-output-tp26421308p26421308.html Sent from the rspec-users mailing list archive at Nabble.com.
On Thu, Nov 19, 2009 at 4:11 AM, bqaanne <beccy_anne at hotmail.com> wrote:> > Hi, > > I am very new to Ruby and Rspec, and found a simple tutorial online about > rspec. > > It involves two files: > bowling.rb and bowling_spec.rb > > # bowling_spec.rb > require''rubygems'' > require ''spec'' > require ''bowling'' > > describe Bowling do > it "should score 0 for gutter game" do > bowling = Bowling.new > 20.times { bowling.hit(0) } > bowling.score.should == 0 > end > end > > #bowling.rb > class Bowling > def hit(pins) > end > > def score > 1 > end > end > > When I run the spec, I expect to see some sort of output along these lines: > "Bowling should score 0 for gutter game". > > When I run it (from text mate) there are no errors, and there is no output. > I see the same result running it from the command line. > > Am I doing something wrong? > > Thanks, > BeccyWhat command are you using from the command line? And what about in textmate? Do you have the RSpec tmbundle installed?>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091119/f5f43cc4/attachment.html>
>What command are you using from the command line? And what about in >textmate? Do you have the RSpec tmbundle installed?When I run from the command line I use "ruby bowling_spec.rb" and it appears to just do nothing, but no errors are thrown. When I run in text mate, i just save the file and hit Apple+R to run the file. Again there is no output. I have not installed the RSpec tmbundle - having never heard of it before - I will do that and see what happens in text mate, however the fact that its not doing anything on the command line either suggests this is not the problem. -- View this message in context: http://old.nabble.com/Running-simple-rspec%2C-no-output-tp26421308p26435264.html Sent from the rspec-users mailing list archive at Nabble.com.
Problem solved. I was being an idiot. I type in "spec bowling_spec.rb" at command line. And installed the text mate bundle as suggested to allow text mate to display the results. bqaanne wrote:> > > >>What command are you using from the command line? And what about in >>textmate? Do you have the RSpec tmbundle installed? > > When I run from the command line I use "ruby bowling_spec.rb" and it > appears to just do nothing, but no errors are thrown. When I run in text > mate, i just save the file and hit Apple+R to run the file. Again there is > no output. I have not installed the RSpec tmbundle - having never heard of > it before - I will do that and see what happens in text mate, however the > fact that its not doing anything on the command line either suggests this > is not the problem. > > > > >-- View this message in context: http://old.nabble.com/Running-simple-rspec%2C-no-output-tp26421308p26436844.html Sent from the rspec-users mailing list archive at Nabble.com.