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 results in color using console but not tmux unless --use-color is specified

If I create a new Rails (3.2.12) app. Add the test-unit gem to my development, test group, and then scaffolded resource. When I run the tests from the Mac console.app, I get color output. bundle exec rake test When I create a tmux session (in…
BeeZee
  • 1,572
  • 21
  • 25
0
votes
0 answers

verbouse assertions with Test::Unit (minitest?) in ruby 1.9

I'm in the middle of the upgrade of my application. I want to move from ruby 1.8 to 1.9 and from rails 3.0 to 3.2 (right now I run ruby 1.9 and RoR 3.2). I have problems with my tests: the output is vague and not very helpful. For example for…
mrzasa
  • 22,895
  • 11
  • 56
  • 94
0
votes
2 answers

Ruby on Rails, uninitialized constant Test::Unit::TestCase::Assertions (NameError)

Like the headline said, I am getting the aforementioned error when I try to run my rspec tests. The exact error is (word wrapped for readability): /.rvm/gems/ruby-1.9.3-p374/gems/test-unit-2.4.8/lib/test/unit/testcase.rb:93:in `':…
Black Dynamite
  • 4,067
  • 5
  • 40
  • 75
0
votes
1 answer

Strings pulled from Regex apear to match but dont

This doesn't make any sense to me. I am trying to assert that these two dates are the same. They look the same but somehow they are different. #assert correct time and date assert_equal(/[0-9]{1,2}, [0-9]{4} at [0-9]{1,2}:[0-9]{2}…
Zach
  • 885
  • 2
  • 8
  • 27
0
votes
1 answer

How to format output in Test::Unit 2.5.x

We just moved from using the very first version of Test::Unit with the redgreen gem to Test::Unit 2.5.3 and the output is a bit screwed up. I just want to get Test::Unit to output test results like RSpec, and it almost does, but for me, whenever a…
concept47
  • 30,257
  • 12
  • 52
  • 74
0
votes
1 answer

Rails custom route not found when testing, but works for curl

In config/routes.rb: match 'app_config/:version' => "application#appconfig" test/functional/application_controller_test.rb: require 'test_helper' class ApplicationControllerTest < ActionController::TestCase test "app config" do get…
Narfanator
  • 5,595
  • 3
  • 39
  • 71
0
votes
1 answer

cant understand how to use ci_reporter gem

I cant understand how the usage of the ci_reporter gem works. How do I modify my rakefile "to make the ci:setup:testunit task a dependency of your test tasks" I don't understand how to do what this is asking me to do. Can anyone…
Zach
  • 885
  • 2
  • 8
  • 27
0
votes
1 answer

How do I test a paperclip URL?

I'm using Test::Unit, and I'd like to test a paperclip url. Right now, I have a test that looks like this: def test_our_custom_url dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! assert_match…
jrg
  • 731
  • 1
  • 17
  • 34
0
votes
1 answer

Using Test::Unit in an abstraction layer

Is there a way to call assertions from inside an object? I am writing Selenium tests and using test unit for assertions and easy reporting. I have an abstraction layer between the top level test ( class that extends Test::Unit::TestCase) and…
Zach
  • 885
  • 2
  • 8
  • 27
0
votes
1 answer

Can we load multiple factories into the database in one shot?

Just started using factory girl. If one has to save a factory into the db then one has to run FactoryGirl.create(). But is there any way to load a collection of factories into the database without having to call create on each of the factories? If…
Phoenix
  • 192
  • 1
  • 8
0
votes
1 answer

assert_redirected_to usage?

Just starting out in using Test::Unit but having a problem nailing down a redirect test: test "should destroy line_item" do assert_difference('LineItem.count', -1) do delete :destroy, id: @line_item end assert_redirected_to…
prusswan
  • 6,853
  • 4
  • 40
  • 61
0
votes
1 answer

Using the turn gem with Test::Unit

I'm using Turn gem in a rails app to colourise my Test::Unit output, and I find the following output before any of my tests run: stephen@x5:~/code/ruby$ rake test gem install minitest gem install minitest ... tests seem to run just fine, and are…
stephenmurdoch
  • 34,024
  • 29
  • 114
  • 189
0
votes
1 answer

Domain object extraction with MiniTest

I have two questions. The first is a basic one. MiniTest is a drop-in replacement for UnitTest. So if you use generators in rails, you get a bunch of ActiveSupport::TestCase classes. If you use minitest (without minitest-spec-rails) then you can…
squarism
  • 3,242
  • 4
  • 26
  • 35
0
votes
1 answer

Selenium WebDriver for ruby fails with "too many redirects"

I've got this simple test case that tests a login form. For some reason webdriver refuses to run the test and comes back with a "too many redirects" message. The page is just an ordinary login screen, very simple and there are no redirects…
B B
  • 3,922
  • 2
  • 18
  • 13
0
votes
1 answer

test_should_get_show(CartsControllerTest): ActionController::RoutingError: No route matches {:cart=>"1", :controller=>"carts", :action=>"show"}

The error I keep getting is as follows: test_should_get_show(CartsControllerTest): ActionController::RoutingError: No route matches {:cart=>"1", :controller=>"carts", :action=>"show"} When I run the following code: def setup @cart =…
Noah Clark
  • 8,101
  • 14
  • 74
  • 116
1 2 3
24
25