[rspec-users] Specs for Ajax partials with unicode characters
Ashley Moran
work at ashleymoran.me.uk
Fri Feb 16 05:30:57 EST 2007
On Feb 15, 2007, at 6:31 pm, David Chelimsky wrote:
> My concern w/ this approach is that it adds a new potential point of
> failure. IF the decoder has a bug you'll get false pass/fail and it
> would be difficult to track down.
>
That's a good point I hadn't considered. It seems risky to add a
layer of code between the output of Rails and the tests.
Unfortunately I don't know *any* JavaScript - haven't written a line
of it in my life. So I can't say why the Rails team escapes UTF8.
All the other content in my Rails apps gets served as UTF8, so I
don't see why JavaScript should be any different. Maybe it's a
browser workaround. I might ask on the Rails list.
> This is something that's been bugging me about Rails in general
> lately. Why should it need custom testing tools? That smells funny to
> me.
>
> WDYT?
>
Not sure I'm in a position to comment. Like I say, maybe in this
case there's a reason for the bizarre text munging. However, I agree
with what you said a while back about ActiveRecord impeding mocking
(I can't say about the other components as I haven't seen the
source). I've had a look at the Og code recently, and it seems to
have much better separation of concerns. (Having said that, I saw a
blog post by the main developer saying he thought it was getting
crufty.) Much as I like ActiveRecord, the code is incredibly tightly
bound.
I did some work at the end of last year to add class-table
inheritance to ActiveRecord. I had to hack pretty much all of the
Base class code, and it can be really tough to follow the flow
through all the methods it contains. Testing changes it tough too
because it's all pretty monolithic.
I got to the point with CTI where it was working but without
associations. I realised that adding support to the patch for
associations would end up with me duplicating virtually all of the
unit tests. They are frustrating to work on because the fixtures
have become quite brittle. I was about to suggest to the core team
that I rewrite all the unit tests in RSpec, which would give an
opportunity to audit the tests, probably clean them up a bit, and
also give me the opportunity to slot in CTI without turning the unit
tests into an unmaintainable copy-and-paste frenzy. (Kinda depends
on them wanting CTI though.) I actually tried to port one of the
basic tests, but I couldn't manage to integrate RSpec into the
Test::Unit stuff.
There might be some opportunities to refactor ActiveRecord a bit, see
if the code can't be made more isolated and testable. When I get 30
continuous seconds free I'll put all this to the core team.
Unfortunately I don't have a staggering amount of free time to work
on it.
Ashley
More information about the rspec-users
mailing list