0.02
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
RSpec matchers for Neo4j.rb
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 6.0.0
>= 3.0
 Project Readme

Neo4j::Rspec Build Status

This gem contains of several testing one-liners for neo4j gem.

Install

Add line into your Gemfile:

gem "neo4j-rspec"

or install it directly

gem install neo4j-rspec

Then configure it in your spec_helper (or rails_helper):

RSpec.configure do |config|
  config.include Neo4j::RSpec::Matchers
  # ... other configuration ...
end

Examples

ActiveNode matchers:

  • Properties

      it { is_expected.to define_property :general }
      it { is_expected.to define_property :string, :String }
      it { is_expected.to define_property :boolean, :Boolean }
      it { is_expected.to define_property :boolean, :'Neo4j::Shared::Boolean' }
    
  • Relationships

      it { is_expected.to have_many(:comments) }
      it { is_expected.to have_many(:comments).with_direction(:in) }
      it { is_expected.to have_many(:comments).with_direction(:in).with_origin(:post) }
      it { is_expected.to have_many(:written_things).with_direction(:in).without_type.with_model_class([:Post, :Comment]) }
    
  • Constraints

      it { is_expected.to define_constraint :name, :unique }
    
  • Indexes

      # DEPRECATED!  Newer version of the `neo4j` gem no longer support defining indexes on the model
      it { is_expected.to define_index(:index_name) }
    
  • Tracking

      it { is_expected.to track_creations } # `created_at`
      it { is_expected.to track_modifications } # `updated_at`
    

ActiveRel matchers:

  • Directions

      it { is_expected.to come_from(:Person) }
      it { is_expected.to lead_to(:any) }
    
  • Types

      it { is_expected.to have_relationship_type("WROTE") }
    
  • Create Unique

      it { is_expected.to use_create_unique }
      it { is_expected.to use_create_unique(:all) }
      it { is_expected.to use_create_unique(on: [:key1, :key2]) }
    

Need yet another matcher?

Welcome! Feel free to post an issue. Contributions are welcome too.