-
-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Massive test refactorings. #24
Conversation
Pass options to define a default value for "pos" column.
Undefine method `default_test` to stop `test/unit` from complaining about missing tests for that abstract test case. before: 71 tests, 439 assertions, 0 failures, 0 errors after: 71 tests, 439 assertions, 0 failures, 0 errors
This commit ensures that `default_position?` has a meaning in `add_to_list_bottom` again. Before that commit all tests would pass even if you comment `|| default_position?`.
`flay -d test/` reported that ListTest and ListTestWithDefault are almost identical (except the setup). before: 71 tests, 439 assertions, 0 failures, 0 errors after: 71 tests, 439 assertions, 0 failures, 0 errors
before: 71 tests, 439 assertions, 0 failures, 0 errors after: 71 tests, 439 assertions, 0 failures, 0 errors
before: 71 tests, 439 assertions, 0 failures, 0 errors after: 71 tests, 439 assertions, 0 failures, 0 errors
before: 71 tests, 439 assertions, 0 failures, 0 errors after: 71 tests, 439 assertions, 0 failures, 0 errors
before: 71 tests, 439 assertions, 0 failures, 0 errors after: 71 tests, 439 assertions, 0 failures, 0 errors
I am generally non-committal in refactoring tests. IMO, tests need not be very DRY. As long as they represent specs accurately, I am ok with it. I'll take some time review it if you don't mind. |
Sure, no problem. You can cherry-pick commits if you like to. Note, there's also a bugfix at 0a054d6. I've just realized that github displays commits in this pull request randomly. |
Massive test refactorings. This means we need to bump up the version as well.
@splattael : Pulled! Thanks for contributing! |
Gah, made the classic mistake of not running tests before merging. |
Strange, the tests on my box pass (ree, 1.9.2 and 1.9.3). Are you sure you were testing the merged code? I had the same error during refactoring and fixed it here: |
Aye, I do have this commit merged, and I am on ree. |
Ok, thanks. Could please provide following information? Ruby version$ ruby -v ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2011.03 Gem list$ bundle exec gem list activemodel (3.1.1) activerecord (3.1.1) activesupport (3.1.1) acts_as_list (0.1.4) arel (2.2.1) builder (3.0.0) bundler (1.0.21) i18n (0.6.0) json (1.6.1) multi_json (1.0.3) rdoc (3.11) sqlite3 (1.3.4) tzinfo (0.3.31) rake output$ rake /home/ps/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby -I"lib:lib:test" -I"/home/ps/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.9.2.2/lib" "/home/ps/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/**/test_*.rb" Loaded suite /home/ps/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.9.2.2/lib/rake/rake_test_loader Started ....................................................................... Finished in 0.947402 seconds. 71 tests, 439 assertions, 0 failures, 0 errors Does someone else expierence that test failure? |
According to
flay
there was much duplication in test code. This isn't bad by default but it makestest_list.rb
almost unreadable. At least for me.With
test/unit
you can split up duplicate test code into modules. This killed many lines:Before
1355
6268
71 tests, 439 assertions, 0 failures, 0 errors
After
816
2272
71 tests, 439 assertions, 0 failures, 0 errors
Future
flay
still reports similiar code which can be refactored easily but I am not sure if you accept that huge pull request ;)Please follow each commit if the result (Files Changed) is overwhelming.
If you have questions please drop a line :)