Why am I getting "Test is not a class" in this Ruby script? - Stack Overflow
Skip to main content Stack Overflow About Products OverflowAI Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand OverflowAI GenAI features for Teams OverflowAPI Train & fine-tune LLMs Labs The future of collective knowledge sharing About the company Visit the blog
current community
Stack Overflow help chat Meta Stack Overflowyour communities
Sign up or log in to customize your list.more stack exchange communities
company blog Log in Sign up Home Questions Tags Users Companies Labs Jobs Discussions CollectivesCommunities for your favorite technologies. Explore all Collectives
TeamsNow available on Stack Overflow for Teams! AI features where you work: search, IDE, and chat.
Learn more Explore Teams TeamsAsk questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsGet early access and see previews of new features.
Learn more about LabsWhy am I getting Test is not a class in this Ruby script?
Ask Question Asked 14 years, 1 month ago Modified 9 years, 7 months ago Viewed 6k times 1I've got a problem with this class
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 endit 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:301anyone have any idea ? Regards Bussiere
ruby class testunit Share Improve this question Follow edited Dec 2, 2011 at 2:05 Andrew Grimm 80.7k 57 57 gold badges 206 206 silver badges 349 349 bronze badges asked Aug 10, 2010 at 6:09 Bussiere Bussiere 1,048 13 13 gold badges 67 67 silver badges 129 129 bronze badges Add a comment |2 Answers 2
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 4Using 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 # = ModuleUse a different name for your test case.
Share Improve this answer Follow answered Aug 10, 2010 at 7:41 Andrew Grimm Andrew Grimm 80.7k 57 57 gold badges 206 206 silver badges 349 349 bronze badges 0 Add a comment | 0Using 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)
Share Improve this answer Follow answered Feb 3, 2015 at 20:45 ZedTuX ZedTuX 2,997 3 3 gold badges 31 31 silver badges 62 62 bronze badges Add a comment |Not the answer you're looking for? Browse other questions tagged ruby class testunit or ask your own question .
The Overflow Blog At scale, anything that could fail definitely will Best practices for cost-efficient Kafka clusters Featured on Meta Announcing a change to the data-dump process Bringing clarity to status tag usage on meta sites What does a new user need in a homepage experience on Stack Overflow? Feedback requested: How do you use tag hover descriptions for curating and do Staging Ground Reviewer MotivationRelated
0 Ruby test unit: uninitialized constant Test::Unit::UnitCase 0 whats wrong with this test? 1 Getting an error with the default tests 0 Why is this very basic unit test failing (ruby 1.9.2p290, Rails 3.0.9)? 2 rails unit test error: Test is not a module 0 Passing a simple test 11 Why undefined method `assert_equal is thrown even after requiring test/unit 4 What am I doing wrong with my rakefile? 1 NoMethodError: undefined method `assert_true 0 minitest say method missing but method is present what am I missing?Hot Network Questions
In Lord Rosse's 1845 drawing of M51, was the galaxy depicted in white or black? Is it possible to travel to USA with legal cannabis? How to load a function from a Vim9 script and call it? What does if you ever get up this way mean? Convert 8 Bit brainfuck to 1 bit Brainfuck / Boolfuck Applying for different jobs finding out it is for the same project between different companies Will a Cavalier's mount grow upon maturity if it already grew from the dedication? Getting an UK Visa with Ricevuta Why do the opposite of skillful virtues result in remorse? Can Christian Saudi Nationals visit Mecca? Can I Use A Server In International Waters To Provide Illegal Content Without Getting Arrested? Short story about humanoid creatures living on ice, which can swim under the ice and eat the moss/plants that grow on the underside of the ice The state of the art on topological rings - the Jacobson topology Largest number possible with +, -, ÷ Can a quadrilateral polygon have 3 obtuse angles? How to solve self-consistent equations numerically? How to Include Mathematical Expressions like \sqrt{8} Inside \qty Command with siunitx? In what instances are 3-D charts appropriate? Are all citizens of Saudi Arabia considered Muslims by the state ? Do all instances of a given string get replaced under a rewrite rule? Creating Layout of 2D Board game Using rule-based symbology for overlapping layers in QGIS Is there a way to do a PhD such that you get a broad view of a field or subfield as a whole? Is it possible to recover from a graveyard spiral? more hot questions Question feedSubscribe to RSS
Question feedTo subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-rbStack Overflow
Questions Help ChatProducts
Teams Advertising TalentCompany
About Press Work Here Legal Privacy Policy Terms of Service Contact Us Cookie Settings Cookie PolicyStack Exchange Network
Technology Culture & recreation Life & arts Science Professional Business API Data Blog Facebook Twitter LinkedIn InstagramSite design / logo © 2024 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2024.9.4.14806