Phlip wrote:
> Railsters:
>
> Despite Rails being the only Web platform designed for TDD,
Really? I have the impression that there are others...if nothing else,
some of the Railsy PHP frameworks have copied this feature.
[...]
> Most importantly, tests should run instantly.
In most cases, mine do. The exceptions are those which use regexps or
DOM wizardry for parsing HTML. I suspect Oniguruma might help here, but
I haven't tried it.
> And I have yet to meet a combination of editor and test
> script
> which does this.
RSpec + autotest + out-of-the-box test scripts + any editor you like.
Done.
>
> The Rails problem is apparently rake db:test:prepare, which clones your
> database
> instead of detecting whether it needs a clone.
When would it *not* need a clone? Tests are supposed to start from a
clean environment.
I think the real time sink may be loading the Rails environment, which
seems to typically take several seconds on an otherwise fast test run.
But I can wait that long for my tests to run.
Jay Fields has posted some stuff on his blog about how to make Rails
unit tests not touch the DB, but I don't really see much need to do
that.
>
> I have heard the fix is ZenTest's autotest. This allegedly loads the
> Ruby "VM"
> once, awaits file changes, and responds correctly to each one.
Yup. That's what it does as far as I understand.
>
> So I have a vanilla Rails 2.3.2 application, and I install autotest (and
> autotest -v does not work,
-v is verbose, not version. The autotest script is part of the ZenTest
package, and doesn't appear to have a version number of its own.
> so I can't see which version number I
> actually get),
> and the gem system claims I have version 4.1.3.
Of what? ZenTest? (FWIW, I'm using ZenTest 3.11.1; I'll have to try
the newer version.)
> And I run autotest in
> the
> project folder, and it says:
>
> $ autotest
> (Not running features. To run features in autotest, set
> AUTOFEATURE=true.)
> /usr/bin/ruby1.8 -I.:lib:test -rubygems -e "%w[test/unit
> test/test_helper.rb].each { |f| require f }" | unit_diff -u
> Loaded suite -e
> Started
>
> Finished in 0.000437 seconds.
>
> 0 tests, 0 assertions, 0 failures, 0 errors
>
> Note the system did not even run the whole test batch, first.
Bizarre. It does for me with RSpec. Are your tests in the directories
that Autotest is searching (which would appear to be test/unit)?
> And note
> it sees
> and warns that it rejects my features folder.
Not quite. It is warning you that it did not even look for your
features folder, and will not look for it unless you set
AUTOFEATURE=true. So try that. (Personally, I think features are too
time-consuming to run as often as tests, because I tend to have them do
a lot of browser simulation.)
> I need it to see my test
> folder
> (NOT a spec folder!).
It should do that. Check your configuration.
>
> Then I make a non-trivial change to a correctly-named test file, save
> the file,
> and nothing triggers. (Pure Ubuntu Linux substrate, BTW.)
>
> So how do I trigger?
Again, this is likely a ZenTest/autotest config issue. What you're
describing as desired is exactly what ZT/AT should normally do.
>
> If I could get that working, how can I TDD both story and unit tests AT
> THE SAME
> TIME, without using two different test runners?
Set AUTOFEATURE=true, like it's telling you in that message. ZT/AT will
call rake test and cucumber as appropriate.
>
> --
> Phlip
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---