{"action":"created","issue":{"url":"https://api.github.com/repos/rubygems/rubygems/issues/1684","repository_url":"https://api.github.com/repos/rubygems/rubygems","labels_url":"https://api.github.com/repos/rubygems/rubygems/issues/1684/labels{/name}","comments_url":"https://api.github.com/repos/rubygems/rubygems/issues/1684/comments","events_url":"https://api.github.com/repos/rubygems/rubygems/issues/1684/events","html_url":"https://github.com/rubygems/rubygems/issues/1684","id":170481689,"number":1684,"title":"Pessimistic major version, unexpected behavior","user":{"login":"camertron","id":575280,"avatar_url":"https://avatars.githubusercontent.com/u/575280?v=3","gravatar_id":"","url":"https://api.github.com/users/camertron","html_url":"https://github.com/camertron","followers_url":"https://api.github.com/users/camertron/followers","following_url":"https://api.github.com/users/camertron/following{/other_user}","gists_url":"https://api.github.com/users/camertron/gists{/gist_id}","starred_url":"https://api.github.com/users/camertron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camertron/subscriptions","organizations_url":"https://api.github.com/users/camertron/orgs","repos_url":"https://api.github.com/users/camertron/repos","events_url":"https://api.github.com/users/camertron/events{/privacy}","received_events_url":"https://api.github.com/users/camertron/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rubygems/rubygems/labels/category%20-%20gem%20spec","name":"category - gem spec","color":"0b02e1"},{"url":"https://api.github.com/repos/rubygems/rubygems/labels/major%20bump","name":"major bump","color":"000000"},{"url":"https://api.github.com/repos/rubygems/rubygems/labels/status:%20working%20/%20ready","name":"status: working / ready","color":"fef2c0"},{"url":"https://api.github.com/repos/rubygems/rubygems/labels/type:%20bug%20report","name":"type: bug report","color":"bfe5bf"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/rubygems/rubygems/milestones/14","html_url":"https://github.com/rubygems/rubygems/milestones/3.0","labels_url":"https://api.github.com/repos/rubygems/rubygems/milestones/14/labels","id":1930875,"number":14,"title":"3.0","description":null,"creator":{"login":"indirect","id":78,"avatar_url":"https://avatars.githubusercontent.com/u/78?v=3","gravatar_id":"","url":"https://api.github.com/users/indirect","html_url":"https://github.com/indirect","followers_url":"https://api.github.com/users/indirect/followers","following_url":"https://api.github.com/users/indirect/following{/other_user}","gists_url":"https://api.github.com/users/indirect/gists{/gist_id}","starred_url":"https://api.github.com/users/indirect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indirect/subscriptions","organizations_url":"https://api.github.com/users/indirect/orgs","repos_url":"https://api.github.com/users/indirect/repos","events_url":"https://api.github.com/users/indirect/events{/privacy}","received_events_url":"https://api.github.com/users/indirect/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":1,"state":"open","created_at":"2016-08-08T22:39:13Z","updated_at":"2016-08-10T19:15:32Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2016-08-10T18:09:12Z","updated_at":"2016-08-10T19:15:32Z","closed_at":"2016-08-10T19:15:32Z","body":"Hey guys,\r\n\r\nI was pairing with a coworker today when we ran into this curiosity:\r\n\r\n```ruby\r\nGem::Requirement.new('~> 2').satisfied_by?(Gem::Version.new('3'))  #=> false\r\n```\r\n\r\nI'm guessing this would be surprising to a number of Ruby developers, especially since the pessimistic operator works differently for minor and patch version segments:\r\n\r\n```ruby\r\nGem::Requirement.new('~> 2.1').satisfied_by?(Gem::Version.new('2.1'))  #=> true\r\nGem::Requirement.new('~> 2.1').satisfied_by?(Gem::Version.new('2.0'))  #=> false\r\n```\r\n\r\nIs this on purpose?\r\n\r\nEnvironment:\r\nRuby 2.1.6\r\nRubygems 2.2.3\r\n\r\nI will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).\r\n"},"comment":{"url":"https://api.github.com/repos/rubygems/rubygems/issues/comments/238973359","html_url":"https://github.com/rubygems/rubygems/issues/1684#issuecomment-238973359","issue_url":"https://api.github.com/repos/rubygems/rubygems/issues/1684","id":238973359,"user":{"login":"drbrain","id":9831,"avatar_url":"https://avatars.githubusercontent.com/u/9831?v=3","gravatar_id":"","url":"https://api.github.com/users/drbrain","html_url":"https://github.com/drbrain","followers_url":"https://api.github.com/users/drbrain/followers","following_url":"https://api.github.com/users/drbrain/following{/other_user}","gists_url":"https://api.github.com/users/drbrain/gists{/gist_id}","starred_url":"https://api.github.com/users/drbrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drbrain/subscriptions","organizations_url":"https://api.github.com/users/drbrain/orgs","repos_url":"https://api.github.com/users/drbrain/repos","events_url":"https://api.github.com/users/drbrain/events{/privacy}","received_events_url":"https://api.github.com/users/drbrain/received_events","type":"User","site_admin":false},"created_at":"2016-08-10T19:15:32Z","updated_at":"2016-08-10T19:15:32Z","body":"This has been expected behavior for some time ([test here](https://github.com/rubygems/rubygems/blob/master/test/rubygems/test_gem_requirement.rb#L290-L293)).\r\n\r\nSee [Gem::Requirement#satisfied_by?](https://github.com/rubygems/rubygems/blob/master/lib/rubygems/requirement.rb#L239-L244) which uses the [~> operation](https://github.com/rubygems/rubygems/blob/master/lib/rubygems/requirement.rb#L24) which uses [Gem::Version#bump](https://github.com/rubygems/rubygems/blob/master/lib/rubygems/version.rb#L214-L229).  See explanation above by @segiddins.\r\n\r\nThis was documented [starting in RubyGems 2.3.0](https://github.com/rubygems/rubygems/commit/fca24a695d2ee3a0bdb9702b752b34d44def6a53), but was expected behavior long before that, you'll see that Gem::Version#bump has had the same behavior [back to 2005](https://github.com/rubygems/rubygems/blob/f554bc5/lib/rubygems/version.rb#L163-L168).\r\n\r\nSee also #896."}}
{"actor":{"display_login":"drbrain"}}