{"action":"created","comment":{"url":"https://api.github.com/repos/AgileVentures/osra/pulls/comments/27790958","id":27790958,"diff_hunk":"@@ -0,0 +1,45 @@\n+require 'rails_helper'\n+include ActiveSupport::Testing::TimeHelpers\n+\n+RSpec.describe DateNotBeyondFirstOfNextMonthValidator do\n+  let(:test_model) do\n+    Class.new do\n+      include ActiveModel::Validations\n+\n+      attr_accessor :date_attr\n+\n+      validates :date_attr, date_not_beyond_first_of_next_month: true\n+    end\n+  end\n+\n+  subject { test_model.new }\n+\n+  before(:all) { travel_to Date.parse \"15-12-2012\" }\n+  after(:all) { travel_back }\n+\n+  let (:today) { Date.current }\n+  let (:yesterday) { today.yesterday }\n+  let (:first_of_next_month) { today.beginning_of_month.next_month }\n+  let (:last_day_of_the_month) { first_of_next_month - 1.day }\n+  let (:second_of_next_month) { first_of_next_month + 1.day }\n+  let (:two_months_ahead) { today + 2.months }\n+\n+  it { is_expected.to allow_value(today).for :date_attr }\n+  it { is_expected.to allow_value(first_of_next_month).for :date_attr }\n+  it { is_expected.to allow_value(yesterday).for :date_attr }\n+  it { is_expected.to allow_value(last_day_of_the_month).for :date_attr }\n+\n+  it { is_expected.to_not allow_value(second_of_next_month).for :date_attr }\n+  it { is_expected.to_not allow_value(two_months_ahead).for :date_attr }\n+\n+  it 'returns appropriate message when validation fails' do\n+    subject.date_attr = two_months_ahead\n+    subject.valid?\n+    expect(subject.errors[:date_attr]).to eq ['can not be later than the first of next month']\n+  end\n+\n+  it \"allows date attribute to be an invalid date format\" do","path":"spec/models/validators/date_not_beyond_first_of_next_month_validator_spec.rb","position":41,"original_position":41,"commit_id":"c06ff5119b8efc0cbfb260c8662969ac02afbbd3","original_commit_id":"c06ff5119b8efc0cbfb260c8662969ac02afbbd3","user":{"login":"NikitaAvvakumov","id":5029403,"avatar_url":"https://avatars.githubusercontent.com/u/5029403?v=3","gravatar_id":"","url":"https://api.github.com/users/NikitaAvvakumov","html_url":"https://github.com/NikitaAvvakumov","followers_url":"https://api.github.com/users/NikitaAvvakumov/followers","following_url":"https://api.github.com/users/NikitaAvvakumov/following{/other_user}","gists_url":"https://api.github.com/users/NikitaAvvakumov/gists{/gist_id}","starred_url":"https://api.github.com/users/NikitaAvvakumov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NikitaAvvakumov/subscriptions","organizations_url":"https://api.github.com/users/NikitaAvvakumov/orgs","repos_url":"https://api.github.com/users/NikitaAvvakumov/repos","events_url":"https://api.github.com/users/NikitaAvvakumov/events{/privacy}","received_events_url":"https://api.github.com/users/NikitaAvvakumov/received_events","type":"User","site_admin":false},"body":":+1: ","created_at":"2015-04-06T09:55:40Z","updated_at":"2015-04-06T09:55:40Z","html_url":"https://github.com/AgileVentures/osra/pull/357#discussion_r27790958","pull_request_url":"https://api.github.com/repos/AgileVentures/osra/pulls/357","_links":{"self":{"href":"https://api.github.com/repos/AgileVentures/osra/pulls/comments/27790958"},"html":{"href":"https://github.com/AgileVentures/osra/pull/357#discussion_r27790958"},"pull_request":{"href":"https://api.github.com/repos/AgileVentures/osra/pulls/357"}}},"pull_request":{"url":"https://api.github.com/repos/AgileVentures/osra/pulls/357","id":32435175,"html_url":"https://github.com/AgileVentures/osra/pull/357","diff_url":"https://github.com/AgileVentures/osra/pull/357.diff","patch_url":"https://github.com/AgileVentures/osra/pull/357.patch","issue_url":"https://api.github.com/repos/AgileVentures/osra/issues/357","number":357,"state":"open","locked":false,"title":"Osra393 extract date not beyond the first of next month validator","user":{"login":"razorcd","id":3721810,"avatar_url":"https://avatars.githubusercontent.com/u/3721810?v=3","gravatar_id":"","url":"https://api.github.com/users/razorcd","html_url":"https://github.com/razorcd","followers_url":"https://api.github.com/users/razorcd/followers","following_url":"https://api.github.com/users/razorcd/following{/other_user}","gists_url":"https://api.github.com/users/razorcd/gists{/gist_id}","starred_url":"https://api.github.com/users/razorcd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/razorcd/subscriptions","organizations_url":"https://api.github.com/users/razorcd/orgs","repos_url":"https://api.github.com/users/razorcd/repos","events_url":"https://api.github.com/users/razorcd/events{/privacy}","received_events_url":"https://api.github.com/users/razorcd/received_events","type":"User","site_admin":false},"body":"https://osraav.atlassian.net/browse/OSRA-393\r\n\r\nExtracted custom validator:  `:date_not_beyond_first_of_next_month`\r\nto `app/models/validators/date_not_beyond_first_of_next_month_validator.rb`","created_at":"2015-04-01T16:22:03Z","updated_at":"2015-04-06T09:55:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44aeaf20d6c055dfeb5c5cb5392ce52d83e1fee7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/AgileVentures/osra/pulls/357/commits","review_comments_url":"https://api.github.com/repos/AgileVentures/osra/pulls/357/comments","review_comment_url":"https://api.github.com/repos/AgileVentures/osra/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AgileVentures/osra/issues/357/comments","statuses_url":"https://api.github.com/repos/AgileVentures/osra/statuses/c06ff5119b8efc0cbfb260c8662969ac02afbbd3","head":{"label":"razorcd:osra393_extract_date_not_beyond_the_first_of_next_month_validator","ref":"osra393_extract_date_not_beyond_the_first_of_next_month_validator","sha":"c06ff5119b8efc0cbfb260c8662969ac02afbbd3","user":{"login":"razorcd","id":3721810,"avatar_url":"https://avatars.githubusercontent.com/u/3721810?v=3","gravatar_id":"","url":"https://api.github.com/users/razorcd","html_url":"https://github.com/razorcd","followers_url":"https://api.github.com/users/razorcd/followers","following_url":"https://api.github.com/users/razorcd/following{/other_user}","gists_url":"https://api.github.com/users/razorcd/gists{/gist_id}","starred_url":"https://api.github.com/users/razorcd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/razorcd/subscriptions","organizations_url":"https://api.github.com/users/razorcd/orgs","repos_url":"https://api.github.com/users/razorcd/repos","events_url":"https://api.github.com/users/razorcd/events{/privacy}","received_events_url":"https://api.github.com/users/razorcd/received_events","type":"User","site_admin":false},"repo":{"id":27792556,"name":"osra","full_name":"razorcd/osra","owner":{"login":"razorcd","id":3721810,"avatar_url":"https://avatars.githubusercontent.com/u/3721810?v=3","gravatar_id":"","url":"https://api.github.com/users/razorcd","html_url":"https://github.com/razorcd","followers_url":"https://api.github.com/users/razorcd/followers","following_url":"https://api.github.com/users/razorcd/following{/other_user}","gists_url":"https://api.github.com/users/razorcd/gists{/gist_id}","starred_url":"https://api.github.com/users/razorcd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/razorcd/subscriptions","organizations_url":"https://api.github.com/users/razorcd/orgs","repos_url":"https://api.github.com/users/razorcd/repos","events_url":"https://api.github.com/users/razorcd/events{/privacy}","received_events_url":"https://api.github.com/users/razorcd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/razorcd/osra","description":"Sponsor orphans in Syria & insure basic life & education requirements for Syrian children","fork":true,"url":"https://api.github.com/repos/razorcd/osra","forks_url":"https://api.github.com/repos/razorcd/osra/forks","keys_url":"https://api.github.com/repos/razorcd/osra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/razorcd/osra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/razorcd/osra/teams","hooks_url":"https://api.github.com/repos/razorcd/osra/hooks","issue_events_url":"https://api.github.com/repos/razorcd/osra/issues/events{/number}","events_url":"https://api.github.com/repos/razorcd/osra/events","assignees_url":"https://api.github.com/repos/razorcd/osra/assignees{/user}","branches_url":"https://api.github.com/repos/razorcd/osra/branches{/branch}","tags_url":"https://api.github.com/repos/razorcd/osra/tags","blobs_url":"https://api.github.com/repos/razorcd/osra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/razorcd/osra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/razorcd/osra/git/refs{/sha}","trees_url":"https://api.github.com/repos/razorcd/osra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/razorcd/osra/statuses/{sha}","languages_url":"https://api.github.com/repos/razorcd/osra/languages","stargazers_url":"https://api.github.com/repos/razorcd/osra/stargazers","contributors_url":"https://api.github.com/repos/razorcd/osra/contributors","subscribers_url":"https://api.github.com/repos/razorcd/osra/subscribers","subscription_url":"https://api.github.com/repos/razorcd/osra/subscription","commits_url":"https://api.github.com/repos/razorcd/osra/commits{/sha}","git_commits_url":"https://api.github.com/repos/razorcd/osra/git/commits{/sha}","comments_url":"https://api.github.com/repos/razorcd/osra/comments{/number}","issue_comment_url":"https://api.github.com/repos/razorcd/osra/issues/comments{/number}","contents_url":"https://api.github.com/repos/razorcd/osra/contents/{+path}","compare_url":"https://api.github.com/repos/razorcd/osra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/razorcd/osra/merges","archive_url":"https://api.github.com/repos/razorcd/osra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/razorcd/osra/downloads","issues_url":"https://api.github.com/repos/razorcd/osra/issues{/number}","pulls_url":"https://api.github.com/repos/razorcd/osra/pulls{/number}","milestones_url":"https://api.github.com/repos/razorcd/osra/milestones{/number}","notifications_url":"https://api.github.com/repos/razorcd/osra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/razorcd/osra/labels{/name}","releases_url":"https://api.github.com/repos/razorcd/osra/releases{/id}","created_at":"2014-12-09T23:26:34Z","updated_at":"2015-02-27T10:00:49Z","pushed_at":"2015-04-05T22:05:40Z","git_url":"git://github.com/razorcd/osra.git","ssh_url":"git@github.com:razorcd/osra.git","clone_url":"https://github.com/razorcd/osra.git","svn_url":"https://github.com/razorcd/osra","homepage":null,"size":2647,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"AgileVentures:develop","ref":"develop","sha":"6779d653a2e6c8057adc398fb5d1adfbada7e6cd","user":{"login":"AgileVentures","id":5116968,"avatar_url":"https://avatars.githubusercontent.com/u/5116968?v=3","gravatar_id":"","url":"https://api.github.com/users/AgileVentures","html_url":"https://github.com/AgileVentures","followers_url":"https://api.github.com/users/AgileVentures/followers","following_url":"https://api.github.com/users/AgileVentures/following{/other_user}","gists_url":"https://api.github.com/users/AgileVentures/gists{/gist_id}","starred_url":"https://api.github.com/users/AgileVentures/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AgileVentures/subscriptions","organizations_url":"https://api.github.com/users/AgileVentures/orgs","repos_url":"https://api.github.com/users/AgileVentures/repos","events_url":"https://api.github.com/users/AgileVentures/events{/privacy}","received_events_url":"https://api.github.com/users/AgileVentures/received_events","type":"Organization","site_admin":false},"repo":{"id":18855271,"name":"osra","full_name":"AgileVentures/osra","owner":{"login":"AgileVentures","id":5116968,"avatar_url":"https://avatars.githubusercontent.com/u/5116968?v=3","gravatar_id":"","url":"https://api.github.com/users/AgileVentures","html_url":"https://github.com/AgileVentures","followers_url":"https://api.github.com/users/AgileVentures/followers","following_url":"https://api.github.com/users/AgileVentures/following{/other_user}","gists_url":"https://api.github.com/users/AgileVentures/gists{/gist_id}","starred_url":"https://api.github.com/users/AgileVentures/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AgileVentures/subscriptions","organizations_url":"https://api.github.com/users/AgileVentures/orgs","repos_url":"https://api.github.com/users/AgileVentures/repos","events_url":"https://api.github.com/users/AgileVentures/events{/privacy}","received_events_url":"https://api.github.com/users/AgileVentures/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AgileVentures/osra","description":"Sponsor orphans in Syria & ensure basic life & education requirements for Syrian children","fork":false,"url":"https://api.github.com/repos/AgileVentures/osra","forks_url":"https://api.github.com/repos/AgileVentures/osra/forks","keys_url":"https://api.github.com/repos/AgileVentures/osra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AgileVentures/osra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AgileVentures/osra/teams","hooks_url":"https://api.github.com/repos/AgileVentures/osra/hooks","issue_events_url":"https://api.github.com/repos/AgileVentures/osra/issues/events{/number}","events_url":"https://api.github.com/repos/AgileVentures/osra/events","assignees_url":"https://api.github.com/repos/AgileVentures/osra/assignees{/user}","branches_url":"https://api.github.com/repos/AgileVentures/osra/branches{/branch}","tags_url":"https://api.github.com/repos/AgileVentures/osra/tags","blobs_url":"https://api.github.com/repos/AgileVentures/osra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AgileVentures/osra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AgileVentures/osra/git/refs{/sha}","trees_url":"https://api.github.com/repos/AgileVentures/osra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AgileVentures/osra/statuses/{sha}","languages_url":"https://api.github.com/repos/AgileVentures/osra/languages","stargazers_url":"https://api.github.com/repos/AgileVentures/osra/stargazers","contributors_url":"https://api.github.com/repos/AgileVentures/osra/contributors","subscribers_url":"https://api.github.com/repos/AgileVentures/osra/subscribers","subscription_url":"https://api.github.com/repos/AgileVentures/osra/subscription","commits_url":"https://api.github.com/repos/AgileVentures/osra/commits{/sha}","git_commits_url":"https://api.github.com/repos/AgileVentures/osra/git/commits{/sha}","comments_url":"https://api.github.com/repos/AgileVentures/osra/comments{/number}","issue_comment_url":"https://api.github.com/repos/AgileVentures/osra/issues/comments{/number}","contents_url":"https://api.github.com/repos/AgileVentures/osra/contents/{+path}","compare_url":"https://api.github.com/repos/AgileVentures/osra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AgileVentures/osra/merges","archive_url":"https://api.github.com/repos/AgileVentures/osra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AgileVentures/osra/downloads","issues_url":"https://api.github.com/repos/AgileVentures/osra/issues{/number}","pulls_url":"https://api.github.com/repos/AgileVentures/osra/pulls{/number}","milestones_url":"https://api.github.com/repos/AgileVentures/osra/milestones{/number}","notifications_url":"https://api.github.com/repos/AgileVentures/osra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AgileVentures/osra/labels{/name}","releases_url":"https://api.github.com/repos/AgileVentures/osra/releases{/id}","created_at":"2014-04-16T20:43:09Z","updated_at":"2015-03-31T20:49:59Z","pushed_at":"2015-04-06T08:41:22Z","git_url":"git://github.com/AgileVentures/osra.git","ssh_url":"git@github.com:AgileVentures/osra.git","clone_url":"https://github.com/AgileVentures/osra.git","svn_url":"https://github.com/AgileVentures/osra","homepage":"","size":6059,"stargazers_count":10,"watchers_count":10,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":6,"forks":35,"open_issues":6,"watchers":10,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/AgileVentures/osra/pulls/357"},"html":{"href":"https://github.com/AgileVentures/osra/pull/357"},"issue":{"href":"https://api.github.com/repos/AgileVentures/osra/issues/357"},"comments":{"href":"https://api.github.com/repos/AgileVentures/osra/issues/357/comments"},"review_comments":{"href":"https://api.github.com/repos/AgileVentures/osra/pulls/357/comments"},"review_comment":{"href":"https://api.github.com/repos/AgileVentures/osra/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AgileVentures/osra/pulls/357/commits"},"statuses":{"href":"https://api.github.com/repos/AgileVentures/osra/statuses/c06ff5119b8efc0cbfb260c8662969ac02afbbd3"}}}}