Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
RSpec matchers for ActiveModel::Serializers
branch: master

Require rspec

latest commit 11a35a8637
twinturbo authored
Failed to load latest commit information.
lib Require rspec
spec Initial commit
.gitignore Initial commit
Gemfile Initial commit
LICENSE Initial commit Fix error in readme
Rakefile Initial commit
active_model_serializers-matchers.gemspec Fix gem name


RSpec Matchers for testing ActiveModel::Serializers

This gem currently works with the 0.1.0 release. It will be updated for the next public release when that happens.


Add this line to your application's Gemfile:

gem 'active_model_serializer-matchers'

And then execute:

$ bundle

Or install it yourself as:

$ gem install active_model_serializer-matchers


Matchers are automatically included in all specs in spec/serializers.

Here are some examples

describe BlogPostSerializer do
   it { should have_attribute(:title) }
   it { should have_attribute(:text) }

   it { should have_one(:author) }

   it { should have_many(:comments) }
   it { should have_many(:comments).as(:responses) }

   it { should embed(:objects) }

   it { should include_root }

   it { should include_root(:blog_post) } # if you want to test the root is specifically set to a different value


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Something went wrong with that request. Please try again.