from /usr/lib/ruby/gems/1.8/gems/rspec-1.2.4/lib/spec/runner/options.rb:119:in `run_examples' from /usr/lib/ruby/gems/1.8/gems/rspec-1.2.4/lib/spec/runner/command_line.rb:9:in `run' from /usr/lib/ruby/gems/1.8/gems/rspec-1.2.4/bin/spec:4 ...The good news is that the issue is fixed in 6.7 builds and for 6.5.1 you can fix it by downloading this file and copying it to the netbeans_install_dir/ruby2 directory. You may want to make a backup of the existing nb_rspec_mediator.rb file in that directory first.
Update: There was still an issue with running focused tests as reported by Asfand Yar Qazi. I've now changed the link to point to a newer version that should fix that problem.
(ARGV is an Array, hence the code completion dialog shows just the appropriate methods for it.)
(STDOUT is an instance of IO.)
Constants from other modules/classes:
(Date::ITALY is a number.)
And finally, local constants:
That's it for constants, in the next installment of the series I'll talk about TI for methods.
-Djruby.compat.version=RUBY1_9switch. If you have a plain Ruby project, you can add it to the JVM Arguments field in Project Properties -> Run. For a Rails project, you need to add
jvm.args=-Djruby.compat.version=RUBY1_9to
path_to_your_project dir/nbproject/project.properties.(Obviously, there needs to be a more user friendly way to do this). Note that if you want to run JRuby in 1.9 mode from the command line, it is as easy as
jruby --1.9 ...If you use MRI, it is enough to point the project to use a MRI 1.9 platform and the parser will be switched to the 1.9 mode automatically. Now, time for a screenshot of the 1.9 parser in action (see e.g. this document for changes in 1.9):
The notable thing in the above screenshot is of course the lack of error stripes in the editor.
As always, please give it a try and let me know how it works for you (see here for instructions on how to get a dev build). Also, please note the debugging support for 1.9 is still not there.
Another enhancement which you can see above is the result bar for showing the percentage of passed tests (thanks to Tor for that component). Both of these improvements are actually also in the JUnit, PHP and Python test runners since they are all using the same common test runner API.
And this is what you get after choosing "find_by_price_and..." in the above (and invoking CC again):
Now I still need to add similar support for dynamic scopes that are coming in Rails 2.3.
In the project logical view, under the platform node, you can now see the gems installed for that platform:
At least I find myself often wanting to look at sources for gems, so this should make it a bit more convenient to open gem source files in the IDE.
The Rake Runner dialog now maintains a list of previously entered task parameters (instead of just the last one entered):
For db:migrate tasks it also prepopulates the combo box with the migrations found in the project:
It'd be nice if the combo box had autocomplete, something I'll need to look at that still.
There are also a couple of testing related enhancements, one is Run Focused test and Run again/Debug support for Shoulda and another one a visual diff viewer for assert_equals failures.
There's a View Differences action on the test method node for assert_equals failures:
(And as you can see the test runner's got a new set of icons too).
When you invoke it, you get the following viewer:
There is more of course, but I'll leave something for the next entry too. Comments / ideas for improvements / bug reports are welcomed as always!
Chris Kutler and Brian Leonard have finished their NetBeans Ruby book. I had the pleasure to be the book's technical reviewer. I think Chris and Brian did a great job, the book should be a good resource for anyone using (or thinking about using) NetBeans for Ruby development. Congrats Chris and Brian!
In the past, when somebody reported an issue, we often had to ask the reporter to turn on detailed logging in order to be able to track down the problem. To do this, he/she had to edit the netbeans.conf file and restart the IDE, as described here. We always felt that this is a bit stupid and might frustrate the reporter (for a reason), so I finally got around to implement an option for this in the IDE. So the next time you report an issue and we ask for a log file with detailed logging turned on, it is enough to check the check boxes above, no restart is needed. For normal use it is however best to keep detailed logging off (for performance reasons).
Folks using Shoulda should be happy to hear that NetBeans now has at least some rudimentary support for it:
I didn't know the plugin myself, learned about it thanks to the user who reported an issue about it. It seems interesting and since it builds on top of Test/Unit, basic support for it was straightforward to add (in fact some things worked already before fixing the issue). Some things are still missing, such as jump to source for Shoulda test methods, and I'm sure there are things that I haven't yet discovered.
Another testing related enhancement are the new context menu actions in the test runner:
For individual methods:
And for suites:
I think this is kinda nice, but unfortunately it didn't make it into 6.5. Of course, you can still run individual test methods in 6.5 (as in 6.1 already) by hitting Alt-Shift-F6 (or Alt-Shift-F5 for debugging) when you're within a test method in the editor. Also, some may have noticed from the above screenshots that failed test methods node in the test runner display now have the error message inlined, thanks to Tor's patch.
I think that's about it for now -- Martin has also been working on new things; I'm sure he will blog about those at some point. As mentioned, these enhancements are only available in trunk (i.e. the next release) nightly builds, downloadable here, and of course in continous builds.
Since the initial introduction of the new test runner in the NetBeans Ruby IDE it has gone through some changes and improvements that I thought I should document somewhere. Eventually I'll turn this into a wiki page. I'll explain here a bit what it does under the hoods; it might not be that interesting for all users as it should just work, but I'm sure many users like to understand what exactly it runs.
There are at most three test related actions in the menu: Test, RSpec Test and AutoTest:
What actions are displayed depends on what gems you have installed; if the target platform of the project has the RSpec gem installed, the RSpec Test action is visible. Similarly for AutoTest, just that it requires the ZenTest gem.
By default, the Test and RSpec Test actions try to invoke the corresponding Rake task and run that. So if your project has a 'test' Rake task, that will be run by the Test action. For RSpec Test action the respective Rake task is 'spec'. So in effect these actions are just shortcuts for rake 'test' and 'spec' tasks, if the project has such tasks. If not, they will run all tests found in the test folders of the project; the RSpec Test actions runs all *spec.rb files in those folders and the Test action in turn all *test.rb and test*.rb files.
The AutoTest action basically just runs the autotest command on the project. It was integrated with the new test runner just recently, in 6.5 Beta AutoTest results are displayed just in the output window.
The test runner now checks for project.properties (and/or private.properties) for the following properties:
If those properties are not defined, the test runner will run by default the following tasks:
test.tasks=test,my_tests,yet_another_test_task spec.tasks=spec,my_test_specsIf you define the property but leave the value empty, no tasks will be associated with the test runner. So if you for some reason don't want to run any tasks through the test runner, you can do:
test.tasks= spec.tasks=
RailsConf Europe is taking place next week in Berlin and we'll be present there too. I have a session with Petr Jiricka on developing Ruby and Rails applications with the NetBeans IDE on Thursday. Those interested in NetBeans and/or JRuby might find also the following sessions of interest:
If you have any particular things that you'd like to see covered in our session, let me know and we'll try to fit it in the presentation.
The conference seems to be full of interesting sessions, I'm looking forward to learning what's happening in the Rails world and speaking to people there. We'll have a NetBeans booth there somewhere, so if you'll be there and want to have a chat about NetBeans or anything just come by the booth, or let me know and we can arrange a meetup somewhere.
Based on a couple of postings I've seen on the various Ruby and Rails forums on the internet, there seems to be some confusion about how exactly NetBeans and JRuby are integrated. One source of confusion is probably the term we use for the JRuby version bundled with the IDE, i.e. "built-in". It does not mean that the bundled version is modified in any way to work with the IDE; in fact it is just the standard JRuby distribution and the IDE works fine without it. We do bundle some additional gems, e.g. Rails and activerecord-jdbc-adapter for a better out-of-the-box experience, but the JRuby bits themselves are untouched. You can (and generally should) upgrade to a newer version of JRuby whenever one is available; if you add the new version to your PATH environment variable it will be even autodetected by the IDE -- if not, just add it manually using the Platform manager by pointing it to
Adding a new platform, Tools -> Ruby Platforms
That said, the IDE does still in fact need a JRuby version that is specific to the IDE, namely the internal one that is used for providing editor features. However, this is not the same JRuby as the user visible one (i.e. the "built-in" version visible in the menus), instead it is completely hidden from the user.
PS. In related news, JRuby 1.1.3 was just released -- so go get it!
Another screenshot using a different layout. You're free to drag the results window anywhere in the IDE, the iconless button on the left side of the runner switches the layout from vertical to horizontal and vice versa (note that this will be done automatically once I get to fix this issue).
And finally a screenshot of an RSpec test run:
For those of you who are not familiar the JUnit results window, it might be worth noting a couple things. The results window can be found in Window -> Output -> Ruby Test Results. You can display only failures by using the filter button on the left side of the statistics panel. Double clicking the failed method nodes jump to the failure line in the test file, and you can of course double click the stack trace lines as well for the same effect.
Currently the new UI is invoked only if you specifically select 'Test' or 'RSpec Test' from the project context menu or run a single test file, meaning that running the test or spec rake tasks using the Rake runner in the IDE don't display the results using this UI. This will change of course, just a matter of time - see the link to the issue list in the beginning of this entry.
So, please go grab a fresh build and let me know whatever issues you encounter or how would you enhance it further!