mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
19 lines
490 B
Markdown
19 lines
490 B
Markdown
# How to test
|
|
|
|
## Test helpers
|
|
|
|
ActiveModelSerializers provides a `assert_serializer` method to be used on your controller tests to
|
|
assert that a specific serializer was used.
|
|
|
|
```ruby
|
|
class PostsControllerTest < ActionController::TestCase
|
|
test "should render post serializer" do
|
|
get :index
|
|
assert_serializer "PostSerializer"
|
|
end
|
|
end
|
|
```
|
|
|
|
See [ActiveModelSerializers::Test::Serializer](../../lib/active_model_serializers/test/serializer.rb)
|
|
for more examples and documentation.
|