Closed tonini closed 11 years ago
definitely :+1: on this one! Do you have a working solution already?
I haven't. There're still some question I have about how to require liberiers.
require_relative 'test_helper'
require_relative '../lib/tiny_db'
class TinyDBTest < MiniTest::Unit::TestCase
def setup
@db = TinyDB.new
end
end
as an example In the case like above I just run ruby test/tiny_db_test.rb
.
-I
parameter by the ruby parser to add the directory to the ruby lib path.require_relative 'test_helper'
require 'tiny_db'
class TinyDBTest < MiniTest::Unit::TestCase
def setup
@db = TinyDB.new
end
end
command usage like ruby -I lib test/test_db_test.rb
as example
what do you think?
I think the test_helper
must ensure that the lib environment works. I wouldn't supply -Ilib to the ruby
binary. I think there should be a mode out already to run test-unit tests. I'll have a look at this one later on.
ok, thank you.
@senny Do you know quickrun.el -> https://github.com/syohex/emacs-quickrun ?
What do you think about integrating it into cabbage?
I'm not too keen on adding dependencies just to use a single function. I can see the use of it but running a ruby buffer can easily be achieved with ruby-compilation-this-buffer
.
There is also ruby-compilation-this-test
which, seems to be able to run a single test-unit test. combining these functions with the testing API already in cabbage should yield a similar result as the rspec-mode
I see the point and I agree with it. As you already said ruby-compilation-this-test
is what we need. I'm using ruby-compilation-this-buffer
at the moment. The thing we have to work out is that every compilation function in ruby-compilation.el
doesn't clear the buffer after a run. Otherwise, I quite like it. :+1:
I would like to kill the test report buffer if exists, as I mentioned before. Something like this:
(just an example)
(defun cabbage--run-single-ruby-file ()
(interactive)
(let* ((name (file-name-nondirectory (car (split-string (buffer-file-name)))))
(name-buffer (format "*%s*" name)))
(if (get-buffer name-buffer)
(kill-buffer name-buffer))
(ruby-compilation-run (buffer-file-name))))
implemented d3529a942932757fcc596554344bbe63608a8e7e
What do you guys think about running
*_test.rb
files under emacs like it does for*_spec.rb
files already?cheers
/cc @senny