
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
jsonapi-rspec
Advanced tools
RSpec matchers for JSON API.
Add the following to your application's Gemfile:
gem 'jsonapi-rspec'
And then execute:
$ bundle
Add to your spec/spec_helpers.rb:
# spec/spec_helpers.rb
require 'jsonapi/rspec'
RSpec.configure do |config|
config.include JSONAPI::RSpec
# Support for documents with mixed string/symbol keys. Disabled by default.
config.jsonapi_indifferent_hash = true
end
Available matchers:
expect(document['data']).to have_id('12')expect(document['data']).to have_type('users')expect(document['data']).to have_jsonapi_attributes(:name, :email)expect(document['data']).to have_jsonapi_attributes(:name, :email, :country).exactlyexpect(document['data']).to have_attribute(:name).with_value('Lucas')expect(document['data']).to have_relationships(:posts, :comments)expect(document['data']).to have_relationships(:posts, :comments, :likes).exactlyexpect(document['data']).to have_relationship(:posts).with_data([{ 'id' => '1', 'type' => 'posts' }])expect(document['data']['relationships']['posts']).to have_links(:self, :related)expect(document['data']).to have_link(:self).with_value('http://api.example.com/users/12')expect(document).to have_metaexpect(document).to have_meta('foo' => 'bar')expect(document).to have_meta('foo' => 'bar', 'fum' => 'baz').exactlyexpect(document).to have_jsonapi_objectexpect(document).to have_jsonapi_object('version' => '1.0')expect(document).to have_error('status' => '422')Note: JSON:API spec requires JSON documents, thus attribute, relationship and link matcher arguments will always be converted into strings for consistency!!!
Basically, the tests bellow are absolutely equal:
expect(document['data']).to have_id(12)
expect(document['data']).to have_id('12')
expect(document['data']).to have_type(:users)
expect(document['data']).to have_type('users')
expect(document['data']).to have_jsonapi_attributes(:name, :email)
expect(document['data']).to have_jsonapi_attributes('name', 'email')
The JSON:API spec also requires the id and type to be strings, so any other
argument passed will also be converted into a string.
If the document you are trying to test has mixed string/symbol keys, just
configure matchers to be indifferent in that regard, using the
jsonapi_indifferent_hash = true configuration option.
Checking for an included resource:
expect(response_body['included'])
.to include(have_type('posts').and have_id('1'))
Bug reports and pull requests are welcome on GitHub at https://github.com/jsonapi-rb/jsonapi-rspec
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
jsonapi-rspec is released under the MIT License.
FAQs
Unknown package
We found that jsonapi-rspec demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.