You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today I spent four hours or so trying to figure out why my controller tests (functional) was breaking when trying to pass params as JSON. I thought that I was doing something wrong and that I better get another job, unitl I learnt that this is really a Rails bug (not to be fixed anytime soon, by the way, since it's in the 5.0 milestone).
Then I learnt that you can pass params as JSON in Integration tests. (Yeah!!!)
So, since Rails-API is really meant for APIs and JSON will be probably the most common media-type, wouldn't it we useful to either:
Add a comment on POST and PATCH methods like "If you need to pass params as JSON, write an Integration test"
Generate and integration test automatically for the create and update actions
Add a sample of Integration test with params as JSON when the app is generated, commented.
I think that 3) and a comment would be cool. What do you think?
The text was updated successfully, but these errors were encountered:
I was waiting for some more feedback, but I guess that there's enough alrady. I'll try to submit a PR in the next days with either 2) or 3). I guess that option 2) would be the most useful.
Today I spent four hours or so trying to figure out why my controller tests (functional) was breaking when trying to pass params as JSON. I thought that I was doing something wrong and that I better get another job, unitl I learnt that this is really a Rails bug (not to be fixed anytime soon, by the way, since it's in the 5.0 milestone).
Then I learnt that you can pass params as JSON in Integration tests. (Yeah!!!)
So, since Rails-API is really meant for APIs and JSON will be probably the most common media-type, wouldn't it we useful to either:
create
andupdate
actionsI think that 3) and a comment would be cool. What do you think?
The text was updated successfully, but these errors were encountered: