Benjamin Fleischer
0c2153ac5e
Collect more Rails initialization code in the Railtie
2016-01-15 01:52:27 -06:00
Benjamin Fleischer
316026e9ce
Merge branch 'CorainChicago-changelog'
2016-01-15 01:05:37 -06:00
Benjamin Fleischer
47f6db203c
Touchup Changelog
2016-01-15 01:05:31 -06:00
CorainChicago
8ffcdc7668
update CHANGELOG
2016-01-15 01:05:31 -06:00
Benjamin Fleischer
87ca408ead
Merge pull request #1425 from beauby/extract-serializer-modules
...
[CLEANUP] Extract links and type-related methods to their own module.
2016-01-15 00:56:40 -06:00
Benjamin Fleischer
92e8a0a246
Merge pull request #1417 from koryteg/custom_root_docs
...
[DOCS] added documentation for adding custom root
2016-01-15 00:52:56 -06:00
Benjamin Fleischer
ac13053790
Merge branch 'maurogeorge-patch-09'
...
Rebased from cb3afa93ffa75a65b080c764547020bee2f2f191 to 9aed6ac63
and resolved conflicts by Benjamin Fleischer (bf4)
2016-01-15 00:47:06 -06:00
Mauro George
5058694f4a
Create assert_response_schema test helper
...
It is a common pattern to use JSON Schema to validate a API response[1], [2]
and [3].
This patch creates the `assert_response_schema` test helper that helps people do
this kind of validation easily on the controller tests.
[1]: https://robots.thoughtbot.com/validating-json-schemas-with-an-rspec-matcher
[2]: https://github.com/sharethrough/json-schema-rspec
[3]: https://github.com/rails-api/active_model_serializers/issues/1011#issuecomment-127608121
2016-01-15 00:45:56 -06:00
Benjamin Fleischer
9aed6ac634
Merge pull request #1390 from bf4/maurogeorge-patch-02
...
Bring back assert_serializer for controller testing
2016-01-14 17:54:31 -06:00
Mauro George
2f8c430a09
Update the RFC to use ActiveModelSerializers
...
After some internal discussion was decided to use the ActiveModelSerializers
namespace.
This patch update the content following this idea.
Ref:
https://github.com/rails-api/active_model_serializers/pull/1310/files#r45947587
https://github.com/rails-api/active_model_serializers/pull/1310/files#r47144210
2016-01-14 19:21:33 -02:00
Benjamin Fleischer
f5e2b991bf
Remove outdated regression test
...
Per https://github.com/rails-api/active_model_serializers/pull/1390#discussion_r48322329
2016-01-13 21:47:08 -06:00
Benjamin Fleischer
9779185d57
Restore test-local subscriber teardown
...
This commit revises 0ce4ad35a12ffd858f6a5d7bbeb48fc1e2cfac92
`Remove unused/unusable unsubscribe since we don't want to unsubscribe`
Looking at Rails implementation of assert_template
which was likely the inspiration for assert_serializer:
f756b33c13/lib/rails/controller/testing/template_assertions.rb
Ref:
- https://github.com/rails-api/active_model_serializers/pull/596
- https://github.com/rails-api/active_model_serializers/pull/620
- https://github.com/rails-api/active_model_serializers/issues/616
2016-01-13 21:47:08 -06:00
Benjamin Fleischer
e60937bc2f
Remove duplicate documentation
2016-01-13 21:47:08 -06:00
Benjamin Fleischer
28f314aef2
Surface logging event name for re-use
2016-01-13 21:47:08 -06:00
Benjamin Fleischer
a43cff4ae3
Remove assert_template from Test::SerializerTest
...
Rails 5 removed this assertion after considering it not
a good testing practice. https://github.com/rails/rails/issues/18950
Rather that add a gem to our Rails 5 matrix to support it,
the assertion is made that the template is rendering using
active support notifications.
Also, to clarify that the action 'render_template' is unrelated to the
event name '!render_template.action_view', I renamed the actions
so that would not look like event names.
2016-01-13 21:47:08 -06:00
Benjamin Fleischer
14a62a2405
Fix Rails 5 warnings (uses Rails5Shim)
2016-01-13 21:35:45 -06:00
Benjamin Fleischer
f59431439d
Remove unused/unusable unsubscribe since we don't want to unsubscribe
...
In 0.9 (which this implementation is based on), the instrumentation
was `!serialize.active_model_serializers`.
https://github.com/rails-api/active_model_serializers/pull/596/
The '!' in the event name meant the event wasn't meant for
production.
https://github.com/rails/rails/pull/10446/files#r4075679
Since we intend the event for production and have a log subscriber,
if we unsubscribe from `render.active_model_serializers`, we'll
break other tests that are relying on that event being subscribed.
2016-01-13 20:54:22 -06:00
Benjamin Fleischer
ef09c9043f
Small perf, readability refactor to Test::Serializer
2016-01-13 20:54:22 -06:00
Benjamin Fleischer
37a6d2b245
Be consisent in usage of ActiveSupport::Autoload
2016-01-13 20:54:22 -06:00
Mauro George
c0b99c980c
Bring back assert_serializer for controller testing
...
The `assert_serializer` test helper was added in 0.9.0.apha1[1],
and was not included in 0.10.
This patch brings back the `assert_serializer` test helper. This is the last
revision[2] that has the helper. The original helper was used as base.
[1]: https://github.com/rails-api/active_model_serializers/pull/596
[2]: 610aeb2e92
- Create the AssertSerializer
- Use the Test namespace
- Make the tests pass on the Rails master
- Rails 5 does not include `assert_template` but we need this on the tests of
the helper.
- This add the `rails-controller-testing` to keep support on `assert_template`.
- Only load test helpers in the test environment
2016-01-13 20:54:22 -06:00
Benjamin Fleischer
d448481b6b
Merge pull request #1386 from bf4/warnings_fix_again
...
Remove capture_warnings testing. Is fickle and Rubocop linting is good enough
2016-01-13 20:17:24 -06:00
Benjamin Fleischer
dde843d162
Add serialization docs PR request note for conditional attributes
2016-01-13 10:19:07 -06:00
Benjamin Fleischer
2f74dd9682
Merge pull request #1432 from biow0lf/patch-1
...
Fix link in ARCHITECTURE.md [ci skip]
2016-01-13 10:00:12 -06:00
Igor Zubkov
aa8e306782
Fix ARCHITECTURE.md
2016-01-13 17:45:18 +02:00
Lucas Hosseini
3aeb34b0b8
Add docs for deserialization.
2016-01-13 08:40:38 +01:00
Lucas Hosseini
53c59a1510
Merge pull request #1403 from beauby/conditional-attributes
...
Conditional attributes/associations (if/unless).
2016-01-13 07:50:59 +01:00
Lucas Hosseini
2696557650
Replace Field#included? with Field#excluded?.
2016-01-13 06:20:05 +01:00
Lucas Hosseini
7af198653d
Add tests for conditional attributes/associations.
2016-01-13 06:20:05 +01:00
Chris Nixon
7fbf7e536d
Use condition_type in case statement for included?.
2016-01-13 06:20:05 +01:00
Lucas Hosseini
40ed7b57bd
Factor out ancestor class Field of Attribute and Reflection.
2016-01-13 06:20:04 +01:00
Lucas Hosseini
6860318133
Add support for if/unless on associations.
2016-01-13 06:19:47 +01:00
Lucas Hosseini
a502b5d38b
Add support for if/unless on attributes.
2016-01-13 06:19:28 +01:00
Lucas Hosseini
adaf5b87df
Merge pull request #1248 from beauby/jsonapi-parse
...
JSON API deserialization.
2016-01-13 06:18:52 +01:00
Lucas Hosseini
20a58d7f5c
Add support for JSON API deserialization (experimental).
2016-01-13 05:48:06 +01:00
Lucas Hosseini
2e87c8effe
Fix comment.
2016-01-13 05:41:32 +01:00
Benjamin Fleischer
d466466660
Merge pull request #1427 from brigade/defunct-root-name
...
Remove defunct .root_name from test fixtures
2016-01-12 17:25:49 -06:00
Benjamin Fleischer
1d8226098f
Merge pull request #1429 from brigade/association-inheritance
...
Remove unnecessary `dup` in `ActiveModel::Serializer::Associations#associate`
2016-01-12 17:25:41 -06:00
Ben Woosley
8ac1f107f4
Remove unnecessary dup in ActiveModel::Serializer::Associations#associate
...
The `_reflections` are duped on `inherited` - no need to `dup` them
with each addition.
2016-01-12 14:42:07 -08:00
Ben Woosley
251e33a0a1
Don't pluralize the CollectionSerializer#root for #json_key
...
One of three constituents is used to provide the
CollectionSerializer's #json_key:
1) the :root option - controlled by the caller
2) the #name of the first resource serializer - the root or
underscored model name
3) the underscored #name of the resources object - generally
equivalent to the underscored model name of #2
Of the three, only the latter 2 are out of the callers control, and
only the latter two are expected to be singular by default. Not
pluralizing the root gives the caller additional flexibility in
defining the desired root, whether conventionally plural,
unconventionally plural (e.g. objects_received:) or singular.
2016-01-12 09:32:43 -08:00
Lucas Hosseini
f6fe0c8aa3
Extract links and type-related methods to their own module.
2016-01-12 15:05:39 +01:00
Benjamin Fleischer
e3b9597d1a
Remove warning capture; more trouble than worth
2016-01-11 23:48:40 -06:00
Benjamin Fleischer
2a171da6b9
Hack Minitest to make it less dependent on at_exit
2016-01-11 23:42:45 -06:00
Benjamin Fleischer
3133422654
Add .bundle/ to simplecov exclude
2016-01-11 23:42:45 -06:00
Ben Woosley
c8839f427b
Remove defunct .root_name from test fixtures
...
Was removed elsewhere in
7847d05ecb
2016-01-11 17:16:00 -08:00
Benjamin Fleischer
34e5faa1c4
Merge pull request #1423 from brigade/tidy-tests
...
Tidy up the tests
2016-01-11 18:40:11 -06:00
Ben Woosley
0a6c133d25
Tidy up the tests
...
* Use assert_nil where appropriate
* Lead with the expected value in collection_serializer_test.rb, etc
so that expected/actual in test failure messages are not reversed
2016-01-07 11:21:19 -08:00
Kory Tegman
aeefb6a080
revised docs to reflect the feedback
2016-01-06 22:21:19 -08:00
Kory Tegman
d153dfe2cd
added documentation for adding custom root
2016-01-06 15:57:49 -08:00
Mauro George
a183645ed4
Create the Namespace RFC
...
[ci skip]
Update the RFC adding info from discussion
[ci skip]
2016-01-06 19:13:31 -02:00
lcp
43312fa083
support read_multi
2016-01-05 20:55:34 +08:00