{"action":"created","comment":{"url":"https://api.github.com/repos/elasticsearch/logstash/pulls/comments/22956228","id":22956228,"diff_hunk":"@@ -0,0 +1,73 @@\n+require \"logstash/config/mixin\"\n+require \"logstash/filters/base\"\n+\n+describe LogStash::Config::Mixin do\n+  context \"when validating :bytes\" do\n+    it \"should validate :bytes\" do\n+      conf_class = Class.new(LogStash::Filters::Base) do\n+        include LogStash::Config::Mixin\n+        config_name \"test\"\n+        milestone 1\n+        config :size_file, :validate => :bytes\n+      end.new({\"size_file\" => \"10Kib\"})\n+      expect(conf_class.size_file).to eq(10240)\n+    end\n+\n+    it \"should allow setting valid default\" do\n+      conf_class = Class.new(LogStash::Filters::Base) do\n+        include LogStash::Config::Mixin\n+        config_name \"test\"\n+        milestone 1\n+        config :size_file, :validate => :bytes, :default => \"10Kib\"\n+      end.new({})\n+      expect(conf_class.size_file).to eq(10240)\n+    end\n+\n+    it \"should accept bytes with no units specified in suffix\" do\n+      conf_class = Class.new(LogStash::Filters::Base) do\n+        include LogStash::Config::Mixin\n+        config_name \"test\"\n+        milestone 1\n+        config :size_file, :validate => :bytes, :default => \"1024\"\n+      end.new({})\n+      expect(conf_class.size_file).to eq(1024)\n+    end\n+\n+    it \"should be case-insensitive\" do\n+      conf_class = Class.new(LogStash::Filters::Base) do\n+        include LogStash::Config::Mixin\n+        config_name \"test\"\n+        milestone 1\n+        config :size_file_1, :validate => :bytes, :default => \"10KIB\"\n+        config :size_file_2, :validate => :bytes, :default => \"10kib\"\n+      end.new({})\n+      expected_bytes = 10240\n+      expect(conf_class.size_file_1).to eq(expected_bytes)\n+      expect(conf_class.size_file_2).to eq(expected_bytes)\n+    end\n+\n+    it \"should be space-insensitive\" do\n+      conf_class = Class.new(LogStash::Filters::Base) do","path":"spec/core/config_mixin_spec.rb","position":50,"original_position":50,"commit_id":"c97993f754cda2684d9e53ca101b1c23b0dde895","original_commit_id":"c97993f754cda2684d9e53ca101b1c23b0dde895","user":{"login":"ph","id":640,"avatar_url":"https://avatars.githubusercontent.com/u/640?v=3","gravatar_id":"","url":"https://api.github.com/users/ph","html_url":"https://github.com/ph","followers_url":"https://api.github.com/users/ph/followers","following_url":"https://api.github.com/users/ph/following{/other_user}","gists_url":"https://api.github.com/users/ph/gists{/gist_id}","starred_url":"https://api.github.com/users/ph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ph/subscriptions","organizations_url":"https://api.github.com/users/ph/orgs","repos_url":"https://api.github.com/users/ph/repos","events_url":"https://api.github.com/users/ph/events{/privacy}","received_events_url":"https://api.github.com/users/ph/received_events","type":"User","site_admin":false},"body":"I just learned that you can give name to your `subject`. see https://relishapp.com/rspec/rspec-core/v/3-1/docs/subject/explicit-subject#use-`subject(:name)`-to-define-a-memoized-helper-method\r\n\r\n```ruby\r\ndescribe \"named subject\" do\r\n  subject(:bank) { Bank.new }\r\n\r\n  it \"doesnt have any money\" do\r\n    expect(bank.balance).to eq(0)\r\n  end\r\nend\r\n```","created_at":"2015-01-14T18:09:50Z","updated_at":"2015-01-14T18:09:50Z","html_url":"https://github.com/elasticsearch/logstash/pull/2321#discussion_r22956228","pull_request_url":"https://api.github.com/repos/elasticsearch/logstash/pulls/2321","_links":{"self":{"href":"https://api.github.com/repos/elasticsearch/logstash/pulls/comments/22956228"},"html":{"href":"https://github.com/elasticsearch/logstash/pull/2321#discussion_r22956228"},"pull_request":{"href":"https://api.github.com/repos/elasticsearch/logstash/pulls/2321"}}},"pull_request":{"url":"https://api.github.com/repos/elasticsearch/logstash/pulls/2321","id":26953187,"html_url":"https://github.com/elasticsearch/logstash/pull/2321","diff_url":"https://github.com/elasticsearch/logstash/pull/2321.diff","patch_url":"https://github.com/elasticsearch/logstash/pull/2321.patch","issue_url":"https://api.github.com/repos/elasticsearch/logstash/issues/2321","number":2321,"state":"open","locked":false,"title":"add support for :bytes validation to config","user":{"login":"talevy","id":388837,"avatar_url":"https://avatars.githubusercontent.com/u/388837?v=3","gravatar_id":"","url":"https://api.github.com/users/talevy","html_url":"https://github.com/talevy","followers_url":"https://api.github.com/users/talevy/followers","following_url":"https://api.github.com/users/talevy/following{/other_user}","gists_url":"https://api.github.com/users/talevy/gists{/gist_id}","starred_url":"https://api.github.com/users/talevy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talevy/subscriptions","organizations_url":"https://api.github.com/users/talevy/orgs","repos_url":"https://api.github.com/users/talevy/repos","events_url":"https://api.github.com/users/talevy/events{/privacy}","received_events_url":"https://api.github.com/users/talevy/received_events","type":"User","site_admin":false},"body":"fixes issue https://github.com/elasticsearch/logstash/issues/1921\r\n\r\nallows for friendlier config option for specifying file sizes.\r\n\r\n```\r\n...\r\nconfig :file_size, :validate => :bytes, :default => \"10Kib\"`\r\n...\r\n# Now Obj.file_size == 10240\r\n```\r\n\r\nCurrently uses the [Filesize](https://github.com/dominikh/filesize) rubygem to parse/validate the input.\r\nThis supports both IEC(Binary) and SI units\r\n\r\nfor more context on the different units: https://wiki.ubuntu.com/UnitsPolicy\r\n","created_at":"2015-01-07T12:01:18Z","updated_at":"2015-01-14T18:09:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3cb5d1d4bf1d835a98aeb2cff2426fa669c84818","assignee":{"login":"ph","id":640,"avatar_url":"https://avatars.githubusercontent.com/u/640?v=3","gravatar_id":"","url":"https://api.github.com/users/ph","html_url":"https://github.com/ph","followers_url":"https://api.github.com/users/ph/followers","following_url":"https://api.github.com/users/ph/following{/other_user}","gists_url":"https://api.github.com/users/ph/gists{/gist_id}","starred_url":"https://api.github.com/users/ph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ph/subscriptions","organizations_url":"https://api.github.com/users/ph/orgs","repos_url":"https://api.github.com/users/ph/repos","events_url":"https://api.github.com/users/ph/events{/privacy}","received_events_url":"https://api.github.com/users/ph/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/elasticsearch/logstash/milestones/7","labels_url":"https://api.github.com/repos/elasticsearch/logstash/milestones/7/labels","id":860609,"number":7,"title":"2.0","description":null,"creator":{"login":"jordansissel","id":131818,"avatar_url":"https://avatars.githubusercontent.com/u/131818?v=3","gravatar_id":"","url":"https://api.github.com/users/jordansissel","html_url":"https://github.com/jordansissel","followers_url":"https://api.github.com/users/jordansissel/followers","following_url":"https://api.github.com/users/jordansissel/following{/other_user}","gists_url":"https://api.github.com/users/jordansissel/gists{/gist_id}","starred_url":"https://api.github.com/users/jordansissel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordansissel/subscriptions","organizations_url":"https://api.github.com/users/jordansissel/orgs","repos_url":"https://api.github.com/users/jordansissel/repos","events_url":"https://api.github.com/users/jordansissel/events{/privacy}","received_events_url":"https://api.github.com/users/jordansissel/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":1,"state":"open","created_at":"2014-11-10T19:40:47Z","updated_at":"2015-01-13T10:56:14Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/elasticsearch/logstash/pulls/2321/commits","review_comments_url":"https://api.github.com/repos/elasticsearch/logstash/pulls/2321/comments","review_comment_url":"https://api.github.com/repos/elasticsearch/logstash/pulls/comments/{number}","comments_url":"https://api.github.com/repos/elasticsearch/logstash/issues/2321/comments","statuses_url":"https://api.github.com/repos/elasticsearch/logstash/statuses/c97993f754cda2684d9e53ca101b1c23b0dde895","head":{"label":"talevy:feature/1921-validate-bytes","ref":"feature/1921-validate-bytes","sha":"c97993f754cda2684d9e53ca101b1c23b0dde895","user":{"login":"talevy","id":388837,"avatar_url":"https://avatars.githubusercontent.com/u/388837?v=3","gravatar_id":"","url":"https://api.github.com/users/talevy","html_url":"https://github.com/talevy","followers_url":"https://api.github.com/users/talevy/followers","following_url":"https://api.github.com/users/talevy/following{/other_user}","gists_url":"https://api.github.com/users/talevy/gists{/gist_id}","starred_url":"https://api.github.com/users/talevy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talevy/subscriptions","organizations_url":"https://api.github.com/users/talevy/orgs","repos_url":"https://api.github.com/users/talevy/repos","events_url":"https://api.github.com/users/talevy/events{/privacy}","received_events_url":"https://api.github.com/users/talevy/received_events","type":"User","site_admin":false},"repo":{"id":25496528,"name":"logstash","full_name":"talevy/logstash","owner":{"login":"talevy","id":388837,"avatar_url":"https://avatars.githubusercontent.com/u/388837?v=3","gravatar_id":"","url":"https://api.github.com/users/talevy","html_url":"https://github.com/talevy","followers_url":"https://api.github.com/users/talevy/followers","following_url":"https://api.github.com/users/talevy/following{/other_user}","gists_url":"https://api.github.com/users/talevy/gists{/gist_id}","starred_url":"https://api.github.com/users/talevy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talevy/subscriptions","organizations_url":"https://api.github.com/users/talevy/orgs","repos_url":"https://api.github.com/users/talevy/repos","events_url":"https://api.github.com/users/talevy/events{/privacy}","received_events_url":"https://api.github.com/users/talevy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/talevy/logstash","description":"logstash - logs/event transport, processing, management, search.","fork":true,"url":"https://api.github.com/repos/talevy/logstash","forks_url":"https://api.github.com/repos/talevy/logstash/forks","keys_url":"https://api.github.com/repos/talevy/logstash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/talevy/logstash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/talevy/logstash/teams","hooks_url":"https://api.github.com/repos/talevy/logstash/hooks","issue_events_url":"https://api.github.com/repos/talevy/logstash/issues/events{/number}","events_url":"https://api.github.com/repos/talevy/logstash/events","assignees_url":"https://api.github.com/repos/talevy/logstash/assignees{/user}","branches_url":"https://api.github.com/repos/talevy/logstash/branches{/branch}","tags_url":"https://api.github.com/repos/talevy/logstash/tags","blobs_url":"https://api.github.com/repos/talevy/logstash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/talevy/logstash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/talevy/logstash/git/refs{/sha}","trees_url":"https://api.github.com/repos/talevy/logstash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/talevy/logstash/statuses/{sha}","languages_url":"https://api.github.com/repos/talevy/logstash/languages","stargazers_url":"https://api.github.com/repos/talevy/logstash/stargazers","contributors_url":"https://api.github.com/repos/talevy/logstash/contributors","subscribers_url":"https://api.github.com/repos/talevy/logstash/subscribers","subscription_url":"https://api.github.com/repos/talevy/logstash/subscription","commits_url":"https://api.github.com/repos/talevy/logstash/commits{/sha}","git_commits_url":"https://api.github.com/repos/talevy/logstash/git/commits{/sha}","comments_url":"https://api.github.com/repos/talevy/logstash/comments{/number}","issue_comment_url":"https://api.github.com/repos/talevy/logstash/issues/comments/{number}","contents_url":"https://api.github.com/repos/talevy/logstash/contents/{+path}","compare_url":"https://api.github.com/repos/talevy/logstash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/talevy/logstash/merges","archive_url":"https://api.github.com/repos/talevy/logstash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/talevy/logstash/downloads","issues_url":"https://api.github.com/repos/talevy/logstash/issues{/number}","pulls_url":"https://api.github.com/repos/talevy/logstash/pulls{/number}","milestones_url":"https://api.github.com/repos/talevy/logstash/milestones{/number}","notifications_url":"https://api.github.com/repos/talevy/logstash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/talevy/logstash/labels{/name}","releases_url":"https://api.github.com/repos/talevy/logstash/releases{/id}","created_at":"2014-10-21T01:56:42Z","updated_at":"2015-01-13T00:45:30Z","pushed_at":"2015-01-13T18:48:55Z","git_url":"git://github.com/talevy/logstash.git","ssh_url":"git@github.com:talevy/logstash.git","clone_url":"https://github.com/talevy/logstash.git","svn_url":"https://github.com/talevy/logstash","homepage":"http://logstash.net/","size":70609,"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":"elasticsearch:master","ref":"master","sha":"d86797dea92a635a3c5eed67cb0884c6171920ed","user":{"login":"elasticsearch","id":141304,"avatar_url":"https://avatars.githubusercontent.com/u/141304?v=3","gravatar_id":"","url":"https://api.github.com/users/elasticsearch","html_url":"https://github.com/elasticsearch","followers_url":"https://api.github.com/users/elasticsearch/followers","following_url":"https://api.github.com/users/elasticsearch/following{/other_user}","gists_url":"https://api.github.com/users/elasticsearch/gists{/gist_id}","starred_url":"https://api.github.com/users/elasticsearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elasticsearch/subscriptions","organizations_url":"https://api.github.com/users/elasticsearch/orgs","repos_url":"https://api.github.com/users/elasticsearch/repos","events_url":"https://api.github.com/users/elasticsearch/events{/privacy}","received_events_url":"https://api.github.com/users/elasticsearch/received_events","type":"Organization","site_admin":false},"repo":{"id":1090311,"name":"logstash","full_name":"elasticsearch/logstash","owner":{"login":"elasticsearch","id":141304,"avatar_url":"https://avatars.githubusercontent.com/u/141304?v=3","gravatar_id":"","url":"https://api.github.com/users/elasticsearch","html_url":"https://github.com/elasticsearch","followers_url":"https://api.github.com/users/elasticsearch/followers","following_url":"https://api.github.com/users/elasticsearch/following{/other_user}","gists_url":"https://api.github.com/users/elasticsearch/gists{/gist_id}","starred_url":"https://api.github.com/users/elasticsearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elasticsearch/subscriptions","organizations_url":"https://api.github.com/users/elasticsearch/orgs","repos_url":"https://api.github.com/users/elasticsearch/repos","events_url":"https://api.github.com/users/elasticsearch/events{/privacy}","received_events_url":"https://api.github.com/users/elasticsearch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elasticsearch/logstash","description":"logstash - logs/event transport, processing, management, search.","fork":false,"url":"https://api.github.com/repos/elasticsearch/logstash","forks_url":"https://api.github.com/repos/elasticsearch/logstash/forks","keys_url":"https://api.github.com/repos/elasticsearch/logstash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elasticsearch/logstash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elasticsearch/logstash/teams","hooks_url":"https://api.github.com/repos/elasticsearch/logstash/hooks","issue_events_url":"https://api.github.com/repos/elasticsearch/logstash/issues/events{/number}","events_url":"https://api.github.com/repos/elasticsearch/logstash/events","assignees_url":"https://api.github.com/repos/elasticsearch/logstash/assignees{/user}","branches_url":"https://api.github.com/repos/elasticsearch/logstash/branches{/branch}","tags_url":"https://api.github.com/repos/elasticsearch/logstash/tags","blobs_url":"https://api.github.com/repos/elasticsearch/logstash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elasticsearch/logstash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elasticsearch/logstash/git/refs{/sha}","trees_url":"https://api.github.com/repos/elasticsearch/logstash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elasticsearch/logstash/statuses/{sha}","languages_url":"https://api.github.com/repos/elasticsearch/logstash/languages","stargazers_url":"https://api.github.com/repos/elasticsearch/logstash/stargazers","contributors_url":"https://api.github.com/repos/elasticsearch/logstash/contributors","subscribers_url":"https://api.github.com/repos/elasticsearch/logstash/subscribers","subscription_url":"https://api.github.com/repos/elasticsearch/logstash/subscription","commits_url":"https://api.github.com/repos/elasticsearch/logstash/commits{/sha}","git_commits_url":"https://api.github.com/repos/elasticsearch/logstash/git/commits{/sha}","comments_url":"https://api.github.com/repos/elasticsearch/logstash/comments{/number}","issue_comment_url":"https://api.github.com/repos/elasticsearch/logstash/issues/comments/{number}","contents_url":"https://api.github.com/repos/elasticsearch/logstash/contents/{+path}","compare_url":"https://api.github.com/repos/elasticsearch/logstash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elasticsearch/logstash/merges","archive_url":"https://api.github.com/repos/elasticsearch/logstash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elasticsearch/logstash/downloads","issues_url":"https://api.github.com/repos/elasticsearch/logstash/issues{/number}","pulls_url":"https://api.github.com/repos/elasticsearch/logstash/pulls{/number}","milestones_url":"https://api.github.com/repos/elasticsearch/logstash/milestones{/number}","notifications_url":"https://api.github.com/repos/elasticsearch/logstash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elasticsearch/logstash/labels{/name}","releases_url":"https://api.github.com/repos/elasticsearch/logstash/releases{/id}","created_at":"2010-11-18T01:31:50Z","updated_at":"2015-01-14T18:08:05Z","pushed_at":"2015-01-12T18:23:12Z","git_url":"git://github.com/elasticsearch/logstash.git","ssh_url":"git@github.com:elasticsearch/logstash.git","clone_url":"https://github.com/elasticsearch/logstash.git","svn_url":"https://github.com/elasticsearch/logstash","homepage":"http://logstash.net/","size":85707,"stargazers_count":3522,"watchers_count":3522,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1315,"mirror_url":null,"open_issues_count":571,"forks":1315,"open_issues":571,"watchers":3522,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elasticsearch/logstash/pulls/2321"},"html":{"href":"https://github.com/elasticsearch/logstash/pull/2321"},"issue":{"href":"https://api.github.com/repos/elasticsearch/logstash/issues/2321"},"comments":{"href":"https://api.github.com/repos/elasticsearch/logstash/issues/2321/comments"},"review_comments":{"href":"https://api.github.com/repos/elasticsearch/logstash/pulls/2321/comments"},"review_comment":{"href":"https://api.github.com/repos/elasticsearch/logstash/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/elasticsearch/logstash/pulls/2321/commits"},"statuses":{"href":"https://api.github.com/repos/elasticsearch/logstash/statuses/c97993f754cda2684d9e53ca101b1c23b0dde895"}}}}