{"action":"created","issue":{"url":"https://api.github.com/repos/rspec/rspec-rails/issues/1531","labels_url":"https://api.github.com/repos/rspec/rspec-rails/issues/1531/labels{/name}","comments_url":"https://api.github.com/repos/rspec/rspec-rails/issues/1531/comments","events_url":"https://api.github.com/repos/rspec/rspec-rails/issues/1531/events","html_url":"https://github.com/rspec/rspec-rails/issues/1531","id":128435512,"number":1531,"title":"expect to change not working for has_many :through relationships","user":{"login":"vanboom","id":251706,"avatar_url":"https://avatars.githubusercontent.com/u/251706?v=3","gravatar_id":"","url":"https://api.github.com/users/vanboom","html_url":"https://github.com/vanboom","followers_url":"https://api.github.com/users/vanboom/followers","following_url":"https://api.github.com/users/vanboom/following{/other_user}","gists_url":"https://api.github.com/users/vanboom/gists{/gist_id}","starred_url":"https://api.github.com/users/vanboom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vanboom/subscriptions","organizations_url":"https://api.github.com/users/vanboom/orgs","repos_url":"https://api.github.com/users/vanboom/repos","events_url":"https://api.github.com/users/vanboom/events{/privacy}","received_events_url":"https://api.github.com/users/vanboom/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-25T00:12:37Z","updated_at":"2016-02-01T19:06:11Z","closed_at":"2016-02-01T19:06:11Z","body":"```ruby\r\nclass Item\r\n  has_many :children\r\n  has_many :grandchildren, :through=>:children\r\nend\r\n\r\nIn feature spec...\r\nexpect {\r\n   ... click link to add grandchild to item\r\n  item.reload\r\n  puts item.grandchildren.count  # it works when this puts is added\r\n}.to change(item.grandchildren, :count).by(1)\r\n```\r\n\r\nIf you add a puts statement to print the grandchildren count, then the expectation will pass properly, otherwise it fails.\r\n\r\nthanks!"},"comment":{"url":"https://api.github.com/repos/rspec/rspec-rails/issues/comments/178132695","html_url":"https://github.com/rspec/rspec-rails/issues/1531#issuecomment-178132695","issue_url":"https://api.github.com/repos/rspec/rspec-rails/issues/1531","id":178132695,"user":{"login":"soulcutter","id":97257,"avatar_url":"https://avatars.githubusercontent.com/u/97257?v=3","gravatar_id":"","url":"https://api.github.com/users/soulcutter","html_url":"https://github.com/soulcutter","followers_url":"https://api.github.com/users/soulcutter/followers","following_url":"https://api.github.com/users/soulcutter/following{/other_user}","gists_url":"https://api.github.com/users/soulcutter/gists{/gist_id}","starred_url":"https://api.github.com/users/soulcutter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soulcutter/subscriptions","organizations_url":"https://api.github.com/users/soulcutter/orgs","repos_url":"https://api.github.com/users/soulcutter/repos","events_url":"https://api.github.com/users/soulcutter/events{/privacy}","received_events_url":"https://api.github.com/users/soulcutter/received_events","type":"User","site_admin":false},"created_at":"2016-02-01T19:06:11Z","updated_at":"2016-02-01T19:06:11Z","body":"Closing since this is expected behavior and the solution is explained above."}}