Steve,

Mostly, I would just like a basic set of reference tests for how Rails 
expects that a controller that provides JSON services should act, and even 
though the jbuilder has tests, I don't see much for testing that a 
controller's json API is behaving as expected in:
https://github.com/rails/jbuilder/tree/c3f8ef7bbdb88bec2bcfc27100da63ef6aad4cf1/test

Specifically, I'd like to test that a controller using restful_json is 
responding as close as possible to a normal Rails scaffold-generated 
controller when using the default configuration, even for each of the 
different Rails versions: 3.1.x, 3.2.x, 4.0.x (for now 4.0.0.beta1 and 
edge).

I knew that the scaffold generated tests were light in previous versions of 
Rails, but I somewhat saw that as an artifact of Rails 1.x-3.x really 
focusing on generating HTML pages and forms and those forms interacting 
with a restful API that would return HTML. That is still the case, but now 
that a generated scaffold is producing jbuilder views, the JSON API isn't 
some "option you could use if you want" but rather an integral part of the 
app. I think that the generated scaffold test should test everything that 
is being provided, even if only in a very basic manner. And, for my current 
purposes, I'd actually like something that tests the behavior to a greater 
extent (testing each method of the scaffold generated controllers actions 
in JSON format for success and error conditions; I think that an example 
test could provide this without going overboard.

Regarding new and edit actions in JSON format by generated scaffold 
controllers, since JBuilder currently only generates index and show:
https://github.com/rails/jbuilder/tree/c3f8ef7bbdb88bec2bcfc27100da63ef6aad4cf1/lib/generators/rails/templates
will those have to be manually added by the user if they wish to use 
hypermedia APIs vs. just generating a scaffold?

Thanks!

On Monday, April 15, 2013 12:30:08 PM UTC-4, Steve Klabnik 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.


Reply via email to