I've been using Rinari for a while and I quite like it. But I found
that I wanted to add some extra features to it.
So I had a look at the test suite in:
rinari/test/init.el
When I eval that buffer, the tests fail.
Have the tests been abandoned or am I running them wrong?
I have all the submodules loaded and Rinari works as expected, its
just these tests that fail. The code is eschulte/rinari master branch.
This is the error:
Loaded suite: rinari-suite
FEEEE
5 tests with 5 failures in 0 seconds.
1) Error: rinari-hooks [/home/alex/dev/emacs/rinari/test/init.el:87]
Message: (error "No buffer named units_controller.rb")
Form: (lambda nil
(save-excursion
(unwind-protect
(progn
(let
((default-directory
(format "%s"
(concat
(file-name-directory
(or load-file-name buffer-file-name))
"rails-app/"))))
(find-file "app/controllers/units_controller.rb")
(assert-that hooks-ran)))
(kill-buffer "units_controller.rb")
(setq hooks-ran nil))))
2) Error: rinari-test-test [/home/alex/dev/emacs/rinari/test/init.el:70]
Message: (wrong-type-argument stringp nil)
Form: (lambda nil
(save-excursion
(let
((default-directory
(format "%s"
(concat
(file-name-directory
(or load-file-name buffer-file-name))
"rails-app/"))))
(find-file "app/controllers/units_controller.rb")
(rinari-test)
(assert-equal
(buffer-name)
"*units_controller_test.rb*")
(assert-equal major-mode 'comint-mode)
(kill-buffer "*units_controller_test.rb*")
(kill-buffer "units_controller_test.rb")
(kill-buffer "units_controller.rb"))))
3) Error: rinari-server-test [/home/alex/dev/emacs/rinari/test/init.el:59]
Message: (wrong-type-argument stringp nil)
Form: (lambda nil
(save-excursion
(let
((default-directory
(format "%s"
(concat
(file-name-directory
(or load-file-name buffer-file-name))
"rails-app/"))))
(rinari-web-server)
(assert-equal
(buffer-name)
"*server*")
(assert-that
(get-buffer-process
(current-buffer)))
(kill-buffer
(current-buffer)))))
4) Error: rinari-console-test [/home/alex/dev/emacs/rinari/test/init.el:48]
Message: (wrong-type-argument stringp nil)
Form: (lambda nil
(save-excursion
(let
((default-directory
(format "%s"
(concat
(file-name-directory
(or load-file-name buffer-file-name))
"rails-app/"))))
(rinari-console)
(assert-equal
(buffer-name)
"*ruby*")
(assert-that
(get-buffer-process
(current-buffer)))
(kill-buffer
(current-buffer)))))
5) Failure: rinari-move-test [/home/alex/dev/emacs/rinari/test/init.el:16]
Message: (elunit-test-failed "1 expected to be 37")
Form: (lambda nil
(save-excursion
(let
((max-lisp-eval-depth 2000)
(rails-root
(format "%s"
(concat
(file-name-directory
(or load-file-name buffer-file-name))
"rails-app/"))))
(flet
((here-to-here
(start func end)
(let
((default-directory rails-root))
(find-file
(car start))
(goto-char
(cdr start))
(rinari-launch)
(eval
(list func))
(assert-equal
(file-name-nondirectory
(car end))
(file-name-nondirectory
(buffer-file-name)))
(assert-equal
(cdr end)
(point))
(kill-buffer
(file-name-nondirectory
(car end)))
(kill-buffer
(file-name-nondirectory
(car start))))))
(here-to-here
'("test/unit/example_test.rb" . 153)
'rinari-find-model
'("app/models/example.rb" . 37))
(here-to-here
'("app/controllers/units_controller.rb" . 52)
'rinari-find-test
'("test/functional/units_controller_test.rb" . 150))
(here-to-here
'("app/controllers/units_controller.rb" . 61)
'rinari-find-view
'("app/views/units/fall.html.erb" . 1))))))
Thanks
I believe the tests are in a state of disrepair. Johan Andersson ("rejeep" on this list & github) has a branch in his fork dedicated to updating Rinari's tests: http://github.com/rejeep/rinari/tree/testing
-Steve
> On Aug 8, 9:10 am, Steve Purcell <st...@sanityinc.com> wrote:
>> On 8 Aug 2010, at 08:49, Aleksandar Simic wrote:
>>
>>> Have the tests been abandoned or am I running them wrong?
>>
>> I believe the tests are in a state of disrepair. Johan Andersson ("rejeep" on this list & github) has a branch in his fork dedicated to updating Rinari's tests:http://github.com/rejeep/rinari/tree/testing
>>
>
> I saw that branch but wasn't sure if that is the way to go since
> rejeep's branch hasn't been merged into the esculte's master branch.
>
If Johan is happy with his branch, I can merge it into eschulte/master. Otherwise, if your hope is to get your new feature(s) merged into the master repo, then I can only suggest you work around the currently-failing tests. :-/
-Steve
Hey,My branch has some tests but unfortunately I have had little or no time lately to work on it. I do think Rinari needs some testing and when time comes I will implement them.I haven't asked any of the Rinari maintainers to merge any work I've done so far since I'm not finished. If you think it's better I can do some quick work now to make it possible for a merge with upstream. What do you Rinari maintainers think about that? Maybe it's good to merge since people may be adding other features (with tests) to Rinari and that would then clash with my work. It would be better if the tests would work like they do in my branch.
As the documentation is hosted on rubyforge, if you send me your
rubyforge username I can add you as an administrator of the rubyforge
Rinari project -- which will give you permission to update the
documentation among other things.
Best -- Eric
> My rubyforge username is re-jeep.
Excellent, you should now have administrative permissions for the Rinari
project.
> I'm also going to update some other stuff in the docs, since some are
> outdated and some missing.
>
That sounds great, thanks for taking this on.
I've also added you as a project collaborator on github.
Cheers -- Eric
great to see more action on this list.
I've started the thread in order to add some more "jumps" to Rinari,
that I found lacking, but I wanted to have the accompanying tests to
go with the additions.
Played with elunit tests and saw what Johan has done with ecukes, so I
wanted to go with that to re-write the tests.
But going through the archive I saw mentions of what versions of Rails
should Rinari support, so instead of having the sample app under
test/, the test suite could generate a sample rails app in the Before
step and the test suite would then take it from there. Sort of what
you Johan had in your testing branch, but doing it based on the Rails
version installed on the user's machine, as opposed to sticking with a
particular version by default.
Something like this:
(progn (shell-command "rails -v" "*rails-version*")
(switch-to-buffer "*rails-version*")
(goto-char (point-min))
(if (search-forward "Rails 2" (point-max) t)
(progn (kill-buffer "*rails-version*")
(bs-cycle-previous)
(message "yes, found Rails 2"))
(progn (goto-char (point-min))
(if (search-forward "Rails 3" (point-max) t)
(progn (kill-buffer "*rails-version*")
(bs-cycle-previous)
(message "yes, found Rails 3"))
(message "version unknown")))))
Instead of the messages, another shell-command could be run, creating
the app, then setting the rinari-root based on that and then diving
into tests. (Theres some duplication in the above snippet that could
be trimmed down, but you get the idea)
Now, Johan, I see you've deleted your testing branch where you had
some features already. Are you preparing for a re-write of the tests
or ...?
I want to start on the tests, can't promise how far I'll get, but I
don't want to start on it if you are already doing it.
Back to my "jumps", I see that current Rinari has no jumps set up for
rspec factories. So I've added my own (no tests for them) here:
http://github.com/dotemacs/rinari/commit/ab6ec07bd5b27c9a7718829435a6efb30c25fb19
I want to add jumps for cucumber features too, but I thought it would
be good to do it properly with tests and all, which brings me back to
discussion above.
Thanks,
Aleksandar
---8<-- snip --8<---
> == This is how it looks right now:
> All the old tests are removed. There's a folder in the Rinari root
> called test, were are all unit tests are stored. Testing framework for
> those is Ert (http://github.com/ohler/ert), which should also be used
> for assertions in the Ecukes features. I'm planning to unit test some
> more stuff and there's also a few TODO's in there. It would be great
> if you looked at that stuff to.
> To run the tests you first have to fetch all the submodules:
> $ git submodule init
> $ git submodule update
> Then you simply run the rinari-test script file.
> $ ./test/rinari-test
I will look at your stuff in more detail later today, but I just
wanted to drop this quick note:
running the above script ./test/rinari-test fails on both FreeBSD and Ubuntu.
On FreeBSD the binaries are kept under: /usr/local.
Ubuntu fails too despite having the binary under /usr/bin.
If the first line of the script doesn't call via env, but you specify
the full path to emacs then it runs.
I know that calling scripts via /usr/bin/env is supposed to resolve
this, but by the looks of it it doesn't.
On both OSs emacs 23.x, with bash 4.0.33. The emacs binary is
definitely in the PATH.
Thanks