TL;DR... If someone is going to add this, I'm definitely a +1 (fwiw)


I completely agree with Steve that the generated tests are just examples,
but from there I drew the opposite conclusion (unless I misunderstood what
you said). I might be biased (I wrote
json_expressions<https://github.com/chancancode/json_expressions>),
but I think testing JSON responses is important, especially when they are
used as an API consumed by other components of your system. For that
reason, I think it's definitely worth putting in some examples and
guidance around testing JSON responses.

There are a lot of implementation problems to think about such as (even
when it's just serving the role of an example/placeholder, such as:

- What (not) to cover
- Unit tests or integration tests
- How to assert on the value of the JSON response (I don't think it's worth
pulling in any dependencies here for this, so what I meant is more along
the lines of some pure-Ruby idiom that would work well for the simple cases)

I don't think these are particularly hard problems to solve. Granted, not
everyone would like it, some people would prefer to do it differently and
some simply won't care. However, I think some convention here is better
than no convention.

It was a bit tricky to do before, but since we now picked a "winner"
(jbuilder) for inclusion with core as the default, it should make things
easier, so I think this is a pretty good time to add this. (If we do this
right, other gems would just hook in to the generators and provide
different test cases around their conventions.)

Godfrey

On Mon, Apr 15, 2013 at 9:30 AM, Steve Klabnik <[email protected]>wrote:

> The purpose of generating tests is more about giving a little example
> than testing it thoroughly. Given, as you say, jBuilder has tests,
> doesn't seem tremendously useful.
>
> > (since they really wouldn't be used)
>
> Hypermedia APIs will use these. ;)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to