Skip to content

Instantly share code, notes, and snippets.

@leonelgalan
Created November 28, 2016 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonelgalan/b63d031ece0f3989185c087be3cea285 to your computer and use it in GitHub Desktop.
Save leonelgalan/b63d031ece0f3989185c087be3cea285 to your computer and use it in GitHub Desktop.
Example of lib/active_model_serializers/rspec.rb including ActiveModelSerializers::RSpecMatchers::Schema automatically.
module ActiveModelSerializers
# @api public
# Container module for active_model_serializers specific matchers.
module RSpecMatchers
extend ActiveSupport::Autoload
autoload :Schema, 'active_model_serializers/rspec_matchers/schema'
end
end
RSpec.configure do |config|
config.include ActiveModelSerializers::RSpecMatchers::Schema, type: :request
config.include ActiveModelSerializers::RSpecMatchers::Schema, type: :controller
end
@leonelgalan
Copy link
Author

Two config.include ActiveModelSerializers::RSpecMatchers::Schema because of rspec/rspec-rails#1349

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment