Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
coverage
rdoc
pkg
nbproject
1 change: 1 addition & 0 deletions .rvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rvm 1.9.2@toto
3 changes: 2 additions & 1 deletion test/toto_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'test/test_helper'
require 'test_helper'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one-liner is all that's necessary to enable rake test on 1.9.2 - still works on 1.8.7, I tested it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this line renders me unable to run tests on 1.9.2.

The root cause of 1.9.2 not working is that Ruby removed . from the load path in 1.9.2. Changing the line to:

require File.expand_path File.join(File.dirname(FILE), 'test_helper')

fixes the include relative to the current file problem

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, works with 1.9.2 & ree:

$ rake test 1> /dev/null
/Users/svenkrauter/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -I"lib:lib:test" "/Users/svenkrauter/.rvm/gems/ruby-1.9.2-p136@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/toto_test.rb"

$ rake test 1> /dev/null
/Users/svenkrauter/.rvm/rubies/ree-1.8.7-2010.02/bin/ruby -I"lib:lib:test" "/Users/svenkrauter/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/toto_test.rb"

Taking a look at the Rakefile you will notice that test.pattern is set correctly. I saw you are running a non *NIX OS, perhaps there's some adjustment needed to get going with Windows and the likes.

Cheers

5v3n

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sven,

I've looked at this again and the issue can be broadly summed up as "I'm an idiot". rake test works as expected once I stop doing stupid things as test.libs is setup correctly in the rake file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi BP,

can't copy that - you do not seem like an idiot to me.

;-)

What was the cause then? "Stupid things" is not too far on the specific side.

Cheers

Sven Kräuter | 5v3n

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I'm not an idiot, I've just got a terrible habit of overstating my foolishness when I realise I haven't done something that should have been obvious :D

"Stupid things" was trying to run toto_test.rb directly using ruby test/toto_test.rb instead of using the rake file. Thus lib and test weren't added to the load path which caused require errors and you can see where it all went wrong from there.

Both your and my solutions fix root problem of the current dir not being in the load path; but I'm not sure which approach is better: your is simpler, mine lets you call the test file directly but do we want to let people to do that? Should we be saying the supported way to run tests in to use rake?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see :-)

Two quick answers:

  • rake test is the way to run the tests.
  • 1.9.2 introduces require_relative which should come to your delight ;-).

anyways, relative paths in ruby are a bit on the painful side - there's always pros & cons and to find the right thing is quite hard.

require 'date'

URL = "http://toto.oz"
Expand Down Expand Up @@ -101,6 +101,7 @@
asserts("body should be valid xml") { topic.body }.includes_html("feed > entry" => /.+/)
asserts("summary shouldn't be empty") { topic.body }.includes_html("summary" => /.{10,}/)
end

context "GET /index?param=testparam (get parameter)" do
setup { @toto.get('/index?param=testparam') }
asserts("returns a 200") { topic.status }.equals 200
Expand Down
4 changes: 2 additions & 2 deletions toto.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |s|
s.authors = ["cloudhead"]
s.date = %q{2010-12-01}
s.description = %q{the tiniest blog-engine in Oz.}
s.email = %q{self@cloudhead.net}
s.email = %q{self@cloudhead.net, mail@5v3n.com}
s.extra_rdoc_files = [
"LICENSE",
"README.md"
Expand Down Expand Up @@ -44,7 +44,7 @@ Gem::Specification.new do |s|
"test/toto_test.rb",
"toto.gemspec"
]
s.homepage = %q{http://github.com/cloudhead/toto}
s.homepage = %q{http://github.com/5v3n/toto}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
Expand Down