Questions tagged [testunit]

Test-unit is a unit testing library in Ruby. It was part of the standard library in Ruby 1.8, and there's a compatibility layer in the standard library of Ruby 1.9.

Test-unit is a unit testing library in Ruby. It was part of the standard library in Ruby 1.8, and there's a compatibility layer in the standard library of Ruby 1.9.

Test::Unit (test-unit) is unit testing framework for Ruby, based on xUnit principles. These were originally designed by Kent Beck, creator of extreme programming software development methodology, for Smalltalk's SUnit. It allows writing tests, checking results and automated testing in Ruby.

366 questions
0
votes
1 answer

Test::Unit how to test file operations and file content

I'm looking for a way to test methods that use File class with test_unit. It's really the same thing that issue with Rspec but how to make it work with test_unit. def foo File.open "filename", "w" do |file| file.write("text") end end What…
netbe
  • 236
  • 2
  • 8
0
votes
1 answer

Agile Web Development with Rails: Couldn't find Product with id=1

My destroy unit test for line_item model is failing with the error "Couldn't find Product with id=1". It seems that Rails can't destroy my line_item because it throws an exception when getting it from the database. Here is my LineItem model: class…
StockBreak
  • 2,857
  • 1
  • 35
  • 61
0
votes
1 answer

Passing a simple test

I'm using Rails 3.2's rake tests function. I'm trying to pass a test but it's giving me errors. Btw, when see you how I write, I'm a noob. It's a hacked way of testing, but at least I want to try passing it first. test "product title must have at…
user1372829
  • 1,121
  • 1
  • 11
  • 21
-1
votes
1 answer

formal argument cannot be a class variable in ruby

I've never used Ruby before, and am attempting to run a program written long ago. I've installed Ruby 2.4.1 and the gem package [test-unit 3.4.3] OK, but when I try to run it, I get an error: tcreporter.rb:156: formal argument cannot be a class…
Tarun Rawat
  • 35
  • 1
  • 8
-1
votes
2 answers

Stub `rand` with multiple future values

I know: require 'mocha/setup' Kernel.stub(:rand, -1) do p Kernel.rand #=> -1 p Kernel.rand #=> -1 p Kernel.rand #=> -1 end I need: Kernel.stub(:rand, [-1, -2, -3]) do p Kernel.rand #=> -1 p Kernel.rand #=> -2 p Kernel.rand #=>…
Matrix
  • 3,458
  • 6
  • 40
  • 76
-2
votes
1 answer

Relationship between Selenium, Webdriver, test-unit?

Could someone help by defining the relation between the following: Selenium, Webdriver and most importantly test-unit. Thanks!
1 2 3
24
25