Installing Test-unit-full On JRuby
I would like to use assertions in my cucumber tests such as this:
Then /^I am taken to the page for that item$/ d开发者_StackOverflowo
assert_equal page.find(:xpath, "//h2").text.to_s, $title, "The title you clicked does not match the title on the item page"
end
I have installed the test-unit gem, however, when I run my test, I get this error:
undefined method assert_equal' for #<Object:0x81a> (NoMethodError)
./features/support/web_steps.rb:49:in
/^I am taken to the page for that item$/'
features/userjourney.feature:15:in `Then I am taken to the page for that item'
After googling for a while, it looks like perhaps I need to install the test-unit-full gem. However, I tried this (using jRuby) and got this error:
ERROR: Error installing test-unit-full: ERROR: Failed to build gem native extension. WARNING: JRuby does not support native extensions or the `mkmf' library. Check http://kenai.com/projects/jruby/pages/Home for alternatives.
Do I really need the test-unit-full gem in order to use assertions? And secondly, if so, how can I install the gem on jRuby?
Thanks, Rebecca
You shouldn't need test-unit-full to use assert_equal. Sorry if this is a silly question, but do you have
require 'rubygems'
gem 'test-unit'
require 'test/unit'
at the top of your script? I ran into something similar a while ago and it turns out that without the gem
call I was using an older version of test-unit that came bundled with ruby1.8, rather than the latest version (2.3.0).
精彩评论