{"action":"created","comment":{"url":"https://api.github.com/repos/madlep/fresh_redis/pulls/comments/23503614","id":23503614,"diff_hunk":"@@ -0,0 +1,67 @@\n+require 'fresh_redis'\n+require 'mock_redis'\n+require 'timecop'\n+\n+describe FreshRedis do\n+  subject{ FreshRedis.new(mock_redis) }\n+  let!(:mock_redis) { MockRedis.new }\n+  let(:now) { Time.new(2012, 9, 27, 15, 40, 56, \"+10:00\") }\n+  let(:normalized_now_minute) { Time.new(2012, 9, 27, 15, 40, 0, \"+10:00\") }\n+  let(:normalized_one_minute_ago) { Time.new(2012, 9, 27, 15, 39, 0, \"+10:00\") }\n+  let(:normalized_two_minutes_ago) { Time.new(2012, 9, 27, 15, 38, 0, \"+10:00\") }\n+  let(:normalized_old) { Time.new(2012, 9, 27, 14, 38, 0, \"+10:00\") } \n+\n+  context \"sets\" do \n+    before(:each) { Timecop.travel(now) }\n+    after(:each) { Timecop.return }\n+\n+    describe \"#fsadd\" do\n+      it \"sets a value in a set for the normalized timestamp\" do\n+        Timecop.freeze(now - 3)   { subject.fsadd \"foo\", \"value\" }\n+        Timecop.freeze(now)       { subject.fsadd \"foo\", \"newer_value\" }\n+        Timecop.freeze(now - 60)  { subject.fsadd \"foo\", \"different_bucket\" } # different normalized key\n+\n+        mock_redis.smembers(\"foo:#{normalized_now_minute.to_i}\").should == ['newer_value', 'value']\n+      end\n+\n+      it \"sets a nil value ok\" do\n+        Timecop.freeze(now) { subject.fsadd \"foo\", nil }\n+\n+        mock_redis.smembers(\"foo:#{normalized_now_minute.to_i}\").should == ['']\n+      end\n+\n+      it \"sets the freshness as the expiry\" do\n+        # relying on mock_redis's time handling here - which converts to/from using Time.now Possible flakey temporal breakage potential\n+        subject.fsadd \"foo\", \"baz\", :freshness => 3600\n+\n+        mock_redis.ttl(\"foo:#{normalized_now_minute.to_i}\").should == 3600\n+      end\n+    end\n+\n+    describe \"#fhdel\" do","path":"spec/fresh_redis/set_spec.rb","position":41,"original_position":41,"commit_id":"4b3f2d9f9eba100965de2fdfa988ad21056bd1a8","original_commit_id":"4b3f2d9f9eba100965de2fdfa988ad21056bd1a8","user":{"login":"madlep","id":27223,"avatar_url":"https://avatars.githubusercontent.com/u/27223?v=3","gravatar_id":"","url":"https://api.github.com/users/madlep","html_url":"https://github.com/madlep","followers_url":"https://api.github.com/users/madlep/followers","following_url":"https://api.github.com/users/madlep/following{/other_user}","gists_url":"https://api.github.com/users/madlep/gists{/gist_id}","starred_url":"https://api.github.com/users/madlep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madlep/subscriptions","organizations_url":"https://api.github.com/users/madlep/orgs","repos_url":"https://api.github.com/users/madlep/repos","events_url":"https://api.github.com/users/madlep/events{/privacy}","received_events_url":"https://api.github.com/users/madlep/received_events","type":"User","site_admin":false},"body":"this should be `describe \"#fsrem\"` right?","created_at":"2015-01-25T11:31:05Z","updated_at":"2015-01-25T11:31:05Z","html_url":"https://github.com/madlep/fresh_redis/pull/1#discussion_r23503614","pull_request_url":"https://api.github.com/repos/madlep/fresh_redis/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/madlep/fresh_redis/pulls/comments/23503614"},"html":{"href":"https://github.com/madlep/fresh_redis/pull/1#discussion_r23503614"},"pull_request":{"href":"https://api.github.com/repos/madlep/fresh_redis/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/madlep/fresh_redis/pulls/1","id":27936756,"html_url":"https://github.com/madlep/fresh_redis/pull/1","diff_url":"https://github.com/madlep/fresh_redis/pull/1.diff","patch_url":"https://github.com/madlep/fresh_redis/pull/1.patch","issue_url":"https://api.github.com/repos/madlep/fresh_redis/issues/1","number":1,"state":"open","locked":false,"title":"Added set support to fresh_redis","user":{"login":"felipeclopes","id":2620476,"avatar_url":"https://avatars.githubusercontent.com/u/2620476?v=3","gravatar_id":"","url":"https://api.github.com/users/felipeclopes","html_url":"https://github.com/felipeclopes","followers_url":"https://api.github.com/users/felipeclopes/followers","following_url":"https://api.github.com/users/felipeclopes/following{/other_user}","gists_url":"https://api.github.com/users/felipeclopes/gists{/gist_id}","starred_url":"https://api.github.com/users/felipeclopes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felipeclopes/subscriptions","organizations_url":"https://api.github.com/users/felipeclopes/orgs","repos_url":"https://api.github.com/users/felipeclopes/repos","events_url":"https://api.github.com/users/felipeclopes/events{/privacy}","received_events_url":"https://api.github.com/users/felipeclopes/received_events","type":"User","site_admin":false},"body":"Adding support of set basic methods","created_at":"2015-01-23T16:39:27Z","updated_at":"2015-01-25T11:31:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7eac6e77d018240aeec8dc0bb7bfe96791302876","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/madlep/fresh_redis/pulls/1/commits","review_comments_url":"https://api.github.com/repos/madlep/fresh_redis/pulls/1/comments","review_comment_url":"https://api.github.com/repos/madlep/fresh_redis/pulls/comments/{number}","comments_url":"https://api.github.com/repos/madlep/fresh_redis/issues/1/comments","statuses_url":"https://api.github.com/repos/madlep/fresh_redis/statuses/4b3f2d9f9eba100965de2fdfa988ad21056bd1a8","head":{"label":"felipeclopes:master","ref":"master","sha":"4b3f2d9f9eba100965de2fdfa988ad21056bd1a8","user":{"login":"felipeclopes","id":2620476,"avatar_url":"https://avatars.githubusercontent.com/u/2620476?v=3","gravatar_id":"","url":"https://api.github.com/users/felipeclopes","html_url":"https://github.com/felipeclopes","followers_url":"https://api.github.com/users/felipeclopes/followers","following_url":"https://api.github.com/users/felipeclopes/following{/other_user}","gists_url":"https://api.github.com/users/felipeclopes/gists{/gist_id}","starred_url":"https://api.github.com/users/felipeclopes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felipeclopes/subscriptions","organizations_url":"https://api.github.com/users/felipeclopes/orgs","repos_url":"https://api.github.com/users/felipeclopes/repos","events_url":"https://api.github.com/users/felipeclopes/events{/privacy}","received_events_url":"https://api.github.com/users/felipeclopes/received_events","type":"User","site_admin":false},"repo":{"id":29740550,"name":"fresh_redis","full_name":"felipeclopes/fresh_redis","owner":{"login":"felipeclopes","id":2620476,"avatar_url":"https://avatars.githubusercontent.com/u/2620476?v=3","gravatar_id":"","url":"https://api.github.com/users/felipeclopes","html_url":"https://github.com/felipeclopes","followers_url":"https://api.github.com/users/felipeclopes/followers","following_url":"https://api.github.com/users/felipeclopes/following{/other_user}","gists_url":"https://api.github.com/users/felipeclopes/gists{/gist_id}","starred_url":"https://api.github.com/users/felipeclopes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felipeclopes/subscriptions","organizations_url":"https://api.github.com/users/felipeclopes/orgs","repos_url":"https://api.github.com/users/felipeclopes/repos","events_url":"https://api.github.com/users/felipeclopes/events{/privacy}","received_events_url":"https://api.github.com/users/felipeclopes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/felipeclopes/fresh_redis","description":"Use redis for working with recent temporal based data that can expiry gradually. Useful for things like \"get a count all failed login attempts for the last hour\"","fork":true,"url":"https://api.github.com/repos/felipeclopes/fresh_redis","forks_url":"https://api.github.com/repos/felipeclopes/fresh_redis/forks","keys_url":"https://api.github.com/repos/felipeclopes/fresh_redis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/felipeclopes/fresh_redis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/felipeclopes/fresh_redis/teams","hooks_url":"https://api.github.com/repos/felipeclopes/fresh_redis/hooks","issue_events_url":"https://api.github.com/repos/felipeclopes/fresh_redis/issues/events{/number}","events_url":"https://api.github.com/repos/felipeclopes/fresh_redis/events","assignees_url":"https://api.github.com/repos/felipeclopes/fresh_redis/assignees{/user}","branches_url":"https://api.github.com/repos/felipeclopes/fresh_redis/branches{/branch}","tags_url":"https://api.github.com/repos/felipeclopes/fresh_redis/tags","blobs_url":"https://api.github.com/repos/felipeclopes/fresh_redis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/felipeclopes/fresh_redis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/felipeclopes/fresh_redis/git/refs{/sha}","trees_url":"https://api.github.com/repos/felipeclopes/fresh_redis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/felipeclopes/fresh_redis/statuses/{sha}","languages_url":"https://api.github.com/repos/felipeclopes/fresh_redis/languages","stargazers_url":"https://api.github.com/repos/felipeclopes/fresh_redis/stargazers","contributors_url":"https://api.github.com/repos/felipeclopes/fresh_redis/contributors","subscribers_url":"https://api.github.com/repos/felipeclopes/fresh_redis/subscribers","subscription_url":"https://api.github.com/repos/felipeclopes/fresh_redis/subscription","commits_url":"https://api.github.com/repos/felipeclopes/fresh_redis/commits{/sha}","git_commits_url":"https://api.github.com/repos/felipeclopes/fresh_redis/git/commits{/sha}","comments_url":"https://api.github.com/repos/felipeclopes/fresh_redis/comments{/number}","issue_comment_url":"https://api.github.com/repos/felipeclopes/fresh_redis/issues/comments/{number}","contents_url":"https://api.github.com/repos/felipeclopes/fresh_redis/contents/{+path}","compare_url":"https://api.github.com/repos/felipeclopes/fresh_redis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/felipeclopes/fresh_redis/merges","archive_url":"https://api.github.com/repos/felipeclopes/fresh_redis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/felipeclopes/fresh_redis/downloads","issues_url":"https://api.github.com/repos/felipeclopes/fresh_redis/issues{/number}","pulls_url":"https://api.github.com/repos/felipeclopes/fresh_redis/pulls{/number}","milestones_url":"https://api.github.com/repos/felipeclopes/fresh_redis/milestones{/number}","notifications_url":"https://api.github.com/repos/felipeclopes/fresh_redis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/felipeclopes/fresh_redis/labels{/name}","releases_url":"https://api.github.com/repos/felipeclopes/fresh_redis/releases{/id}","created_at":"2015-01-23T16:08:53Z","updated_at":"2015-01-23T16:38:54Z","pushed_at":"2015-01-23T16:38:54Z","git_url":"git://github.com/felipeclopes/fresh_redis.git","ssh_url":"git@github.com:felipeclopes/fresh_redis.git","clone_url":"https://github.com/felipeclopes/fresh_redis.git","svn_url":"https://github.com/felipeclopes/fresh_redis","homepage":null,"size":154,"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":"master"}},"base":{"label":"madlep:master","ref":"master","sha":"c640f741033a1209feb5b4b157f83574b0769558","user":{"login":"madlep","id":27223,"avatar_url":"https://avatars.githubusercontent.com/u/27223?v=3","gravatar_id":"","url":"https://api.github.com/users/madlep","html_url":"https://github.com/madlep","followers_url":"https://api.github.com/users/madlep/followers","following_url":"https://api.github.com/users/madlep/following{/other_user}","gists_url":"https://api.github.com/users/madlep/gists{/gist_id}","starred_url":"https://api.github.com/users/madlep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madlep/subscriptions","organizations_url":"https://api.github.com/users/madlep/orgs","repos_url":"https://api.github.com/users/madlep/repos","events_url":"https://api.github.com/users/madlep/events{/privacy}","received_events_url":"https://api.github.com/users/madlep/received_events","type":"User","site_admin":false},"repo":{"id":5977070,"name":"fresh_redis","full_name":"madlep/fresh_redis","owner":{"login":"madlep","id":27223,"avatar_url":"https://avatars.githubusercontent.com/u/27223?v=3","gravatar_id":"","url":"https://api.github.com/users/madlep","html_url":"https://github.com/madlep","followers_url":"https://api.github.com/users/madlep/followers","following_url":"https://api.github.com/users/madlep/following{/other_user}","gists_url":"https://api.github.com/users/madlep/gists{/gist_id}","starred_url":"https://api.github.com/users/madlep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madlep/subscriptions","organizations_url":"https://api.github.com/users/madlep/orgs","repos_url":"https://api.github.com/users/madlep/repos","events_url":"https://api.github.com/users/madlep/events{/privacy}","received_events_url":"https://api.github.com/users/madlep/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/madlep/fresh_redis","description":"Use redis for working with recent temporal based data that can expiry gradually. Useful for things like \"get a count all failed login attempts for the last hour\"","fork":false,"url":"https://api.github.com/repos/madlep/fresh_redis","forks_url":"https://api.github.com/repos/madlep/fresh_redis/forks","keys_url":"https://api.github.com/repos/madlep/fresh_redis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/madlep/fresh_redis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/madlep/fresh_redis/teams","hooks_url":"https://api.github.com/repos/madlep/fresh_redis/hooks","issue_events_url":"https://api.github.com/repos/madlep/fresh_redis/issues/events{/number}","events_url":"https://api.github.com/repos/madlep/fresh_redis/events","assignees_url":"https://api.github.com/repos/madlep/fresh_redis/assignees{/user}","branches_url":"https://api.github.com/repos/madlep/fresh_redis/branches{/branch}","tags_url":"https://api.github.com/repos/madlep/fresh_redis/tags","blobs_url":"https://api.github.com/repos/madlep/fresh_redis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/madlep/fresh_redis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/madlep/fresh_redis/git/refs{/sha}","trees_url":"https://api.github.com/repos/madlep/fresh_redis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/madlep/fresh_redis/statuses/{sha}","languages_url":"https://api.github.com/repos/madlep/fresh_redis/languages","stargazers_url":"https://api.github.com/repos/madlep/fresh_redis/stargazers","contributors_url":"https://api.github.com/repos/madlep/fresh_redis/contributors","subscribers_url":"https://api.github.com/repos/madlep/fresh_redis/subscribers","subscription_url":"https://api.github.com/repos/madlep/fresh_redis/subscription","commits_url":"https://api.github.com/repos/madlep/fresh_redis/commits{/sha}","git_commits_url":"https://api.github.com/repos/madlep/fresh_redis/git/commits{/sha}","comments_url":"https://api.github.com/repos/madlep/fresh_redis/comments{/number}","issue_comment_url":"https://api.github.com/repos/madlep/fresh_redis/issues/comments/{number}","contents_url":"https://api.github.com/repos/madlep/fresh_redis/contents/{+path}","compare_url":"https://api.github.com/repos/madlep/fresh_redis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/madlep/fresh_redis/merges","archive_url":"https://api.github.com/repos/madlep/fresh_redis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/madlep/fresh_redis/downloads","issues_url":"https://api.github.com/repos/madlep/fresh_redis/issues{/number}","pulls_url":"https://api.github.com/repos/madlep/fresh_redis/pulls{/number}","milestones_url":"https://api.github.com/repos/madlep/fresh_redis/milestones{/number}","notifications_url":"https://api.github.com/repos/madlep/fresh_redis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/madlep/fresh_redis/labels{/name}","releases_url":"https://api.github.com/repos/madlep/fresh_redis/releases{/id}","created_at":"2012-09-27T04:23:41Z","updated_at":"2014-05-29T19:01:47Z","pushed_at":"2012-11-13T03:12:02Z","git_url":"git://github.com/madlep/fresh_redis.git","ssh_url":"git@github.com:madlep/fresh_redis.git","clone_url":"https://github.com/madlep/fresh_redis.git","svn_url":"https://github.com/madlep/fresh_redis","homepage":null,"size":244,"stargazers_count":8,"watchers_count":8,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/madlep/fresh_redis/pulls/1"},"html":{"href":"https://github.com/madlep/fresh_redis/pull/1"},"issue":{"href":"https://api.github.com/repos/madlep/fresh_redis/issues/1"},"comments":{"href":"https://api.github.com/repos/madlep/fresh_redis/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/madlep/fresh_redis/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/madlep/fresh_redis/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/madlep/fresh_redis/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/madlep/fresh_redis/statuses/4b3f2d9f9eba100965de2fdfa988ad21056bd1a8"}}}}