{"id":15657165,"url":"https://github.com/pat/active-matchers","last_synced_at":"2025-05-05T15:30:16.090Z","repository":{"id":393662,"uuid":"11512","full_name":"pat/active-matchers","owner":"pat","description":"Helpful rspec matchers for testing validations and associations.","archived":false,"fork":false,"pushed_at":"2015-11-15T12:54:23.000Z","size":126,"stargazers_count":23,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T22:05:22.582Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://am.freelancing-gods.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pat.png","metadata":{"files":{"readme":"README.textile","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2008-04-21T09:37:49.000Z","updated_at":"2019-08-13T13:23:24.000Z","dependencies_parsed_at":"2022-07-11T23:00:30.247Z","dependency_job_id":null,"html_url":"https://github.com/pat/active-matchers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pat%2Factive-matchers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pat%2Factive-matchers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pat%2Factive-matchers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pat%2Factive-matchers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pat","download_url":"https://codeload.github.com/pat/active-matchers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252523927,"owners_count":21762001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T13:05:33.412Z","updated_at":"2025-05-05T15:30:16.044Z","avatar_url":"https://github.com/pat.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Some helpful rspec matchers for testing validations and associations. It is not complete, especially in the case of validations, and lacking in documentation, but might be useful nonetheless.\n\nh2. Install\n\n  script/plugin install http://github.com/pat/active-matchers.git\n\nMake sure, in your spec_helper.rb file, you add an include as follows:\n  config.include ActiveMatchers::Matchers\n\n\nh2. Usage\n\nTest @validates_presence_of :name@\n\n  Model.should need(:name).using(@valid_attributes)\n\nTest @validates_uniqueness_of :name@\n\n  Model.should need(:name).to_be_unique.using(@valid_attributes)\n\nTest presence of at least one field being required\n\n  Model.should need.one_of(:first_name, :last_name).using(@valid_attributes)\n\nTest @validates_length_of :name matches@ database field length\n\n  Model.should limit_length_of(:name).using(@valid_attributes)\n\nTest @validates_length_of :name, :maximum =\u003e 255@\n\n  Model.should limit_length_of(:name).to(255).using(@valid_attributes)\n\nTest @validates_length_of :name, :minimum =\u003e 3@\n\n\tModel.should limit_length_of(:name).from(3).using(@valid_attributes)\n\nTest @validates_length_of :name, :within =\u003e 3..40@\n\n  Model.should limit_length_of(:name).from(3).to(40).using(@valid_attributes)\n\nTest @validates_numericality_of :age@\n\n\tModel.should need(:age).to_be_numeric.using(@valid_attributes)\n\n\nYou can group multiple validation checks together like so:\n\n  using(@valid_attributes) do\n    Model.should need(:name)\n    Model.should limit_length_of(:name).to(255)\n  end\n\n\nAlso allows confirmation of the presence of associations\n\nTest @belongs_to :parent@\n\n  Model.should belong_to(:parent)\n\nTest @belongs_to :parent, :class_name =\u003e \"CustomClass\", :foreign_key =\u003e \"some_id\"@\n\n  Model.should belong_to(:parent).with_options(\n    :class_name =\u003e \"CustomClass\", :foreign_key =\u003e \"some_id\")\n\nTest @has_many :items@\n\n  Model.should have_many(:items)\n\nTest @has_many :items, :class_name =\u003e \"CustomClass\", :foreign_key =\u003e \"some_id\"@\n\n  Model.should have_many(:items).with_options(\n    :class_name =\u003e \"CustomClass\", :foreign_key =\u003e \"some_id\")\n    \nSimilar testing available for has_one (@Model.should have_one@) and @has_and_belongs_to_many@ (@Model.should have_and_belong_to_many@)\n\nh2. Authors\n\nCopyright (c) 2007 Pat Allan \u0026 James Healy, released under the MIT license\n\nh2. Contributors\n\n* Chris Lloyd\n* Gareth Townsend\n* Wes Oldenbeuving\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpat%2Factive-matchers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpat%2Factive-matchers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpat%2Factive-matchers/lists"}