How-to run a 'minitest' test?

Hi,

I am trying run the attached test which I found on the ‘minitest’
website: http://bfts.rubyforge.org/minitest/.

However, when I run the meme_test.rb from the command-line I get the
following error message:

C:/Documents and Settings/lblake/Desktop/meme_test.rb:4:in <top (required)>': uninitialized constant Object::Meme (NameError) from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:inload’
from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in
block in load_spec_files' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:inmap’
from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in
load_spec_files' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:inrun’
from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in
run_in_process' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:inrun’
from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:11:in
`block in autorun’

I’ve installed the minitest and rspec gems, I’ve also tried running
rspec meme_test.rb from the command-line with the same result. Is there
something wrong with the code or how I am trying to execute the test?

Lb

On 09/19/2011 03:44 AM, Lb Tr wrote:

     from

How does the code in meme_test.rb know about the code in meme.rb?

You need to either combine these two files into one (not recommended) or
use

 require_relative "meme"

in meme_test.rb

-Justin

On Mon, Sep 19, 2011 at 5:44 AM, Lb Tr [email protected] wrote:

   from

`map’

C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in


Posted via http://www.ruby-forum.com/.

Honestly, it just depends what you’re trying to do. If you just want to
run
it and see them pass, throw them all in the same file and run it. If you
want a really simple script with just the two files, do what Justin said
and
use require_relative to have the test suite pull the other one in. If
you
want to create real app or library, put your stuff where it belongs, set
up
the load path, and require like normal.

Justin C. wrote in post #1022667:

On 09/19/2011 03:44 AM, Lb Tr wrote:

     from

How does the code in meme_test.rb know about the code in meme.rb?

You need to either combine these two files into one (not recommended) or
use

 require_relative "meme"

in meme_test.rb

-Justin

Thanks Justin I added the require_relative “meme” as suggested and all
is fine…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs