{"action":"created","issue":{"url":"https://api.github.com/repos/nevir/rubocop-rspec/issues/52","repository_url":"https://api.github.com/repos/nevir/rubocop-rspec","labels_url":"https://api.github.com/repos/nevir/rubocop-rspec/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/nevir/rubocop-rspec/issues/52/comments","events_url":"https://api.github.com/repos/nevir/rubocop-rspec/issues/52/events","html_url":"https://github.com/nevir/rubocop-rspec/issues/52","id":116479469,"number":52,"title":"Put `subject` at the top of its context block","user":{"login":"backus","id":2085622,"avatar_url":"https://avatars.githubusercontent.com/u/2085622?v=3","gravatar_id":"","url":"https://api.github.com/users/backus","html_url":"https://github.com/backus","followers_url":"https://api.github.com/users/backus/followers","following_url":"https://api.github.com/users/backus/following{/other_user}","gists_url":"https://api.github.com/users/backus/gists{/gist_id}","starred_url":"https://api.github.com/users/backus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/backus/subscriptions","organizations_url":"https://api.github.com/users/backus/orgs","repos_url":"https://api.github.com/users/backus/repos","events_url":"https://api.github.com/users/backus/events{/privacy}","received_events_url":"https://api.github.com/users/backus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nevir/rubocop-rspec/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"nijikon","id":150547,"avatar_url":"https://avatars.githubusercontent.com/u/150547?v=3","gravatar_id":"","url":"https://api.github.com/users/nijikon","html_url":"https://github.com/nijikon","followers_url":"https://api.github.com/users/nijikon/followers","following_url":"https://api.github.com/users/nijikon/following{/other_user}","gists_url":"https://api.github.com/users/nijikon/gists{/gist_id}","starred_url":"https://api.github.com/users/nijikon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nijikon/subscriptions","organizations_url":"https://api.github.com/users/nijikon/orgs","repos_url":"https://api.github.com/users/nijikon/repos","events_url":"https://api.github.com/users/nijikon/events{/privacy}","received_events_url":"https://api.github.com/users/nijikon/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-11-12T04:55:57Z","updated_at":"2016-04-29T12:26:31Z","closed_at":null,"body":"When using subject it should be at the top of its context block, ideally separated by one blank line from any `let`s, `before`s, or `it`s.  \r\n\r\n**good**\r\n```ruby\r\nRSpec.describe SomeClass do\r\n  subject { described_class.new(foo, bar) }\r\n\r\n  let(:foo) { 'foo' }\r\n  let(:bar) { 'bar' }\r\nend\r\n```\r\n\r\n**bad**\r\n```ruby\r\nRSpec.describe SomeClass do\r\n  let(:foo) { 'foo' }\r\n  let(:bar) { 'bar' }\r\n  subject { described_class.new(foo, bar) }\r\nend\r\n```\r\n\r\nthoughts?  Happy to do a PR"},"comment":{"url":"https://api.github.com/repos/nevir/rubocop-rspec/issues/comments/215697969","html_url":"https://github.com/nevir/rubocop-rspec/issues/52#issuecomment-215697969","issue_url":"https://api.github.com/repos/nevir/rubocop-rspec/issues/52","id":215697969,"user":{"login":"andyw8","id":13400,"avatar_url":"https://avatars.githubusercontent.com/u/13400?v=3","gravatar_id":"","url":"https://api.github.com/users/andyw8","html_url":"https://github.com/andyw8","followers_url":"https://api.github.com/users/andyw8/followers","following_url":"https://api.github.com/users/andyw8/following{/other_user}","gists_url":"https://api.github.com/users/andyw8/gists{/gist_id}","starred_url":"https://api.github.com/users/andyw8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyw8/subscriptions","organizations_url":"https://api.github.com/users/andyw8/orgs","repos_url":"https://api.github.com/users/andyw8/repos","events_url":"https://api.github.com/users/andyw8/events{/privacy}","received_events_url":"https://api.github.com/users/andyw8/received_events","type":"User","site_admin":false},"created_at":"2016-04-29T12:26:31Z","updated_at":"2016-04-29T12:26:31Z","body":"I'm not saying it's good, but the majority of specs I see 'in the wild' tend to have the `let`s before the `subject`."}}