{"id":15240469,"url":"https://github.com/izumin5210/rspec-validator_spec_helper","last_synced_at":"2025-04-10T13:42:59.232Z","repository":{"id":25108452,"uuid":"28529794","full_name":"izumin5210/rspec-validator_spec_helper","owner":"izumin5210","description":"Provide dummy class for validator spec","archived":false,"fork":false,"pushed_at":"2016-06-07T11:34:00.000Z","size":16,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T12:21:46.850Z","etag":null,"topics":["rspec","ruby"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/rspec-validator_spec_helper","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/izumin5210.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-27T05:53:30.000Z","updated_at":"2022-12-30T08:24:04.000Z","dependencies_parsed_at":"2022-08-23T19:40:40.720Z","dependency_job_id":null,"html_url":"https://github.com/izumin5210/rspec-validator_spec_helper","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izumin5210%2Frspec-validator_spec_helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izumin5210%2Frspec-validator_spec_helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izumin5210%2Frspec-validator_spec_helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izumin5210%2Frspec-validator_spec_helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/izumin5210","download_url":"https://codeload.github.com/izumin5210/rspec-validator_spec_helper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036044,"owners_count":21037093,"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":["rspec","ruby"],"created_at":"2024-09-29T11:05:08.476Z","updated_at":"2025-04-10T13:42:59.215Z","avatar_url":"https://github.com/izumin5210.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RSpec::ValidatorSpecHelper\n\n[![Build Status](https://travis-ci.org/izumin5210/rspec-validator_spec_helper.svg?branch=master)](https://travis-ci.org/izumin5210/rspec-validator_spec_helper)\n\nProvide dummy class for validator spec\n\n## Installation\n\nAdd this line to your application's Gemfile, then execute `bundle install`.\n\n```ruby\ngem 'rspec-validator_spec_helper'\n```\n\nThen include `Rspec::ValidatorSpecHelper` into your `RSpec.configuration`.\n\n```ruby\n# spec/rails_helper.rb or spec/spec_helper.rb\nRSpec.configure do |config|\n\n  config.include RSpec::ValidatorSpecHelper, type: :validator\n\nend\n```\n\n\n## Usage\n\n`RSpec::ValidatorSpecHelper` provides some `let` and `subject` to your example groups.\n\n\n### EachValidator\n\n```ruby\ndescribe EmailValidator, type: :validator do\n  describe '#validate_each' do\n    context 'with invalid format address' do\n      let(:value) { 'kokoro.pyonpyon' }\n      it { is_expected.to_not be_valid }\n    end\n\n    context 'with valid format address' do\n      let(:value) { 'kokoro.pyonpyon@example.com' }\n      it { is_expected.to be_valid }\n    end\n\n    context 'with strict option' do\n      let(:options) { { strict: true } }\n      let(:value) { 'kokoro..pyonpyon@example.com' }\n      it { is_expected.to_not be_valid }\n    end\n  end\nend\n```\n\n\n### Validator\n\n```ruby\ndescribe NotOverlappedValidator, type: :validator do\n  let(:attribute_names) { [:begin_at, :end_at] }\n  let(:begin_at) { Time.parse(\"2014-12-24T12:00:00+09:00\") }\n\n  describe '#validate' do\n    context 'when end_at is overlapped' do\n      let(:end_at) { Time.parse(\"2014-12-24T09:00:00+09:00\") }\n      it { is_expected.to_not be_valid }\n    end\n\n    context 'when end_at is not overlapped' do\n      let(:end_at) { Time.parse(\"2014-12-24T19:00:00+09:00\") }\n      it { is_expected.to be_valid }\n    end\n\n    context 'with allow_same_time option' do\n      let(:options) { { allow_same_time: true } }\n      let(:end_at) { begin_at }\n      it { is_expected.to be_valid }\n    end\n  end\nend\n```\n\n\n## License\n\nRSpec::ValidatorSpecHelper is licensed under [MIT-LICENSE](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizumin5210%2Frspec-validator_spec_helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fizumin5210%2Frspec-validator_spec_helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizumin5210%2Frspec-validator_spec_helper/lists"}