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

How to test for exceptions in shoulda along with TestUnit?

I have an application based on padrinorb and I am using the shoulda testing library for the same. There is a method that I need to test throws exception. I tried finding the documentation for the same, but couldn't find anything. Here's the sample…
Ankit Dhingra
  • 6,534
  • 6
  • 31
  • 34
0
votes
1 answer

Turn specific error into a failure in ruby Test::Unit

I would like a way to take an error generated within a specific test method inside a Test::Unit::TestCase and turn it into a failure with a more friendly generic message. I keep thinking this should be possible with some inheritance but I can't…
Zach
  • 885
  • 2
  • 8
  • 27
0
votes
2 answers

Where to start with test driven development?

I'm relatively new to Test Driven Development, and I was just wondering where I should start? I understand how to do the testing. I just mean what should I test first? Is there a best practice for this? Should I test the models first? The…
Dylan Karr
  • 3,304
  • 4
  • 19
  • 29
0
votes
1 answer

Testing: patch_via_redirect and strong_parameters

Integration test (with Test/Unit) of update method: test "do the patch" do user = users(:alex) get signin_url assert_response :success post_via_redirect signin_path, email: user.email, password: 'qwerty' assert_equal profile_path, path …
0
votes
4 answers

Having minitest run tests in sequence instead of parallel?

Given the following code: require 'minitest/autorun' require ' class test < MiniTest::Unit::TestCase def setup end def teardown end def test1 end def…
llaskin
  • 789
  • 2
  • 9
  • 24
0
votes
1 answer

is there an equivilent phpunit dataProvider functionality in ruby test-unit gem

I'm currently converting a whole bunch of acceptance tests from php into ruby and many of the tests use specific scenarios to test certain conditions. We use @dataProvider a lot and my google foo can't find any information if this functionality…
Raath
  • 689
  • 1
  • 6
  • 21
0
votes
2 answers

How to test simple ruby method, with timing and config dependencies

I have this method: def self.should_restart? if Konfig.get(:auto_restart_time).present? Time.now>=Time.parse(Konfig.get(:auto_restart_time)) && Utils.uptime_in_minutes>780 end end In regular Ruby (not Rails) how would I go about testing…
jriff
  • 1,947
  • 3
  • 23
  • 33
0
votes
2 answers

Notifications not working with Test::Unit on Mac

I've got a Rails project with a test suite that uses Test::Unit. I'm trying to set up Guard and Spork to run my tests automatically and fire notifications on pass/fail; Guard and Spork are running fine, and fire a notification when they start up,…
amd
  • 512
  • 1
  • 5
  • 13
0
votes
2 answers

text_field.set not working in test script but works fine in irb

I'm trying to rename a folder from:
  • carlmonday
    • 251
    • 1
    • 5
    • 13
  • 0
    votes
    1 answer

    What should be done to run tests in order in which they are defined?

    I've following code: require 'test/unit' class Flow < Test::Unit::TestCase def test_hi puts "Hi" end def test_working puts "Working" end def test_bye puts "Bye" end def test_tired puts…
    Alpha
    • 13,320
    • 27
    • 96
    • 163
    0
    votes
    0 answers

    Fixture data remains in DB with transactional fixtures

    Using Rails 3.2.13 and Test::Unit (actually implemented by MiniTest, if I understand right), I'm seeing fixture data remaining in the database after running the tests. I'm hoping there's a way to set it up so that the database is clean after the…
    Daniel Ashton
    • 1,388
    • 11
    • 23
    0
    votes
    1 answer

    Please suggest why the following test is failing

    The following method passes tests appropriately: def associate_grid_location devices.each do |device| if device.grid_location and grid_location_id.nil? …
    Joe Essey
    • 3,457
    • 8
    • 40
    • 69
    0
    votes
    1 answer

    Parsing Request Headers in Test::Unit

    I'm trying to parse HTTP request headers in Test::Unit, but to no avail. I'm writing a functional test for a controller like so: test "create a shopify order" do get :order, PARAMS, {HEADER1 => VAL, HEADER2 => VAL} assert_response :success #…
    ideaoforder
    • 1,023
    • 2
    • 9
    • 23
    0
    votes
    1 answer

    Repeat the test suite for different input parameters in Test::Unit ruby

    We are building a QA automation setup with test::unit and selenium. Tests for each page in our web app lives in separate directory, and at the top level directory, we have this: require 'rubygems' require 'test/unit' require…
    tamizhgeek
    • 1,371
    • 3
    • 13
    • 25
    0
    votes
    1 answer

    New to Rails -- Webrat methods not working in integration test

    I have a Gemfile: source 'https://rubygems.org' gem 'rails', '3.2.11' gem 'omniauth' gem 'omniauth-facebook' gem 'thin' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' …
    wjandali
    • 112
    • 2
    • 10