[rspec-users] Specs for Ajax partials with unicode characters
dchelimsky at gmail.com
Thu Feb 15 13:31:45 EST 2007
On 2/15/07, Ashley Moran <work at ashleymoran.me.uk> wrote:
> On 15 Feb 2007, at 16:49, David Chelimsky wrote:
> > Yes - looks like json does that transformation. My feeling is that you
> > should probably use '\u00a3500' and that's OK. The reality is that is
> > what shows up in the response.
> > WDYT?
> Eventually I decided to do
> js_pound_sign = '\u00a3'
> and test for
> js_pound_sign + '500'
> This works for me. On the one hand, I agree that it makes sense to
> test the output that is actually rendered. On the other hand, it's
> counter-intuitive to have a partial containing "łączność" (or so
> my Polish colleague tells me) and test for "\u0142\u0105czno\u015b
> The Rails file activesupport/lib/json/encoders/core.rb only contains
> a JSON string ENcoder, but I assume the decoding is straightforward
> enough. What would be nice is something like
> context "my view"
> setup do
> render "moo/quack", :json_to_utf8 => true
> ... specs all receive UTF8 strings ...
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.
This is something that's been bugging me about Rails in general
lately. Why should it need custom testing tools? That smells funny to
> I don't know if it's worth the effort right now though, seeing as you
> probably can just put dummy text in for most stuff that would need
> UTF8 characters. Non-English speakers will probably disagree :)
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users