开发者

Why am I getting "Test is not a class" in this Ruby script?

I've got a problem with this cl开发者_如何学Pythonass

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

it says to me that it's not a class :

/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

anyone have any idea ? Regards Bussiere


Using Test as your class name is a bad idea. It's an existing constant (referring to a module) as soon you require test/unit

require "test/unit"
Test.class # => Module

Use a different name for your test case.


Using Test as your class name is a bad idea.

Wrong ! Today a new version of the rspec-rails gem has been released fixing this issue in some cases.

You can take a look at the the changelog file:

Fix "Test is not a class (TypeError)" error when using a custom Test class in Rails 4.1 and 4.2. (Aaron Kromer, #1295)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜