Ben Mills
cc10928472
Provide Rails url_helpers via SerializationContext
2016-03-07 10:40:34 -07:00
Benjamin Fleischer
fcdb58f67d
Remove AS::Testing::Stream in favor of Minitest assert_output
2016-02-25 23:21:44 -06:00
Benjamin Fleischer
7b98cf3e36
Update SimpleCov; remove compatibility patch
...
Also, SimpleCov.start already called
SimpleCov.pid = Process.pid
So, no need for that
2016-02-09 20:59:31 -06:00
Benjamin Fleischer
509221c1e0
Only call railtie when Rails is defined; assume controller loaded
...
Isolated Testing
- Rake test inspired by https://github.com/rails/rails/blob/v5.0.0.beta1/activejob/Rakefile
- Isolated unit inspired by
- https://github.com/rails/rails/blob/v5.0.0.beta1/railties/test/isolation/abstract_unit.rb
- https://github.com/rails/rails/blob/v5.0.0.beta1/activemodel/test/cases/railtie_test.rb
Misc
- Turns out `mattr_accessor(:logger) {
ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT)) }`
was always nil until the Railtie was loaded, since mattr_accessor
block defaults don't really work on modules, but on the classes that
include them.
- Commented on important on Rails being required first for caching to
work.
- In isolated tests, `active_support/core_ext/object/with_options` is required.
2016-01-15 01:54:07 -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
fce856fc83
Merge pull request #1371 from bf4/documentation_updates
...
[DOCS] Refactor, update, create documentation
2015-12-20 22:30:44 -06:00
Benjamin Fleischer
ce17a1b305
[DOCS] Refactor, update, create documentation [ci skip]
2015-12-14 14:38:29 -06:00
Benjamin Fleischer
28394340d8
Add config.serializer_lookup_enabled that defaults true
2015-11-30 00:20:58 -06:00
Benjamin Fleischer
c56d49f26b
Test keyword args in requests for Rails 5; fallback for earlier versions
...
kwargs: params,session,flash,method,body
Fix Rails 5 DEPRECATION WARNING
2015-11-25 21:56:02 -06:00
Benjamin Fleischer
3b87cb3593
Patch ActionController::TestCase#assigns for Rails5
2015-11-25 21:56:01 -06:00
Benjamin Fleischer
a9ce4fb766
Move caching initialization to Railtie
...
Also
- Add reference to config from ActiveModelSerializers.config
- correctly call super in FragmentCacheTest#setup
- rename test rails app from Foo to ActiveModelSerializers::RailsApplication
2015-11-25 21:56:01 -06:00
Benjamin Fleischer
9d7da8afc4
Add support for top level jsonapi member.
2015-10-01 21:22:49 -05:00
Benjamin Fleischer
26277ea1f9
Remove duplicate test helper
2015-09-16 08:54:33 -05:00
L. Preston Sego III
a453de112b
Merge pull request #1109 from bf4/fix_minitest_after_run
...
Make better use of Minitest's lifecycle
2015-09-15 14:18:07 -04:00
Lucas Hosseini
ebb05959d3
Merge remote-tracking branch 'upstream/master' into improve-tests
2015-09-07 09:03:17 +02:00
Benjamin Fleischer
94469be1ca
Add test coverage; account for no artifacts on CI
...
Drop coverage a bit for JRuby and Rubinius because they
don't generate the same Coverage as CRuby
2015-09-06 09:19:07 -05:00
Benjamin Fleischer
b18671fd03
Make better use of Minitest's lifecycle
...
http://blog.arkency.com/2013/06/are-we-abusing-at-exit/
2015-09-06 07:34:42 -05:00
Benjamin Fleischer
bdfe13c527
Style/StringLiterals single quote all the things
2015-09-03 20:50:45 -05:00
Benjamin Fleischer
09c97de90d
Add Style enforcer (via Rubocop)
...
It will fail the build, but as it is currently,
most of the cops are 'todos'. Great for new contributors.. :)
2015-09-03 20:50:45 -05:00
Lucas Hosseini
4bba16bf4e
Factor with_adapter + force cache clear before each test.
2015-08-28 17:00:24 +02:00
Benjamin Fleischer
530a1bdfd7
Compartmentalize test helper support
2015-08-26 09:19:36 -05:00