我的课程有问题
require "test/unit"
require "selenium/client"
class Test < Test::Unit::TestCase
def setup
@verification_errors = []
@selenium = Selenium::Client::Driver.new \
:host => "localhost",
:port => 4444,
:browser => "*chrome",
:url => "http://change-this-to-the-site-you-are-testing/",
:timeout_in_second => 60
@selenium.start_new_browser_session
end
def teardown
@selenium.close_current_browser_session
assert_equal [], @verification_errors
end
def test_test
@selenium.open "/apj/gestionnaire/flux.ex"
@selenium.wait_for_pop_up "_self", "30000"
end
end
它告诉我,这不是一个班级:
/test.rb:4: Test is not a class (TypeError)
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from C:/Documents and Settings/Micro/My Documents/Aptana RadRails Workspace/.metadata/.plugins/org.rubypeople.rdt.testunit/ruby/RemoteTestRunner.rb:301
谁有任何想法?
问候
比西耶尔
答案 0 :(得分:4)
使用Test
作为您的班级名称是一个坏主意。只要您需要test/unit
require "test/unit"
Test.class # => Module
为您的测试用例使用不同的名称。
答案 1 :(得分:0)
使用Test作为您的班级名称是一个坏主意。
错了!今天发布了新版本的rspec-rails gem,在某些情况下解决了这个问题。
您可以查看the changelog文件:
修复&#34;测试不是类(TypeError)&#34;在Rails 4.1和4.2中使用自定义Test类时出错。 (Aaron Kromer,#1295)