{"action":"created","issue":{"url":"https://api.github.com/repos/BritishBusinessBank/EFG/issues/343","repository_url":"https://api.github.com/repos/BritishBusinessBank/EFG","labels_url":"https://api.github.com/repos/BritishBusinessBank/EFG/issues/343/labels{/name}","comments_url":"https://api.github.com/repos/BritishBusinessBank/EFG/issues/343/comments","events_url":"https://api.github.com/repos/BritishBusinessBank/EFG/issues/343/events","html_url":"https://github.com/BritishBusinessBank/EFG/pull/343","id":209466210,"number":343,"title":"Replace loan factory traits with inheritance","user":{"login":"sidane","id":53722,"avatar_url":"https://avatars.githubusercontent.com/u/53722?v=3","gravatar_id":"","url":"https://api.github.com/users/sidane","html_url":"https://github.com/sidane","followers_url":"https://api.github.com/users/sidane/followers","following_url":"https://api.github.com/users/sidane/following{/other_user}","gists_url":"https://api.github.com/users/sidane/gists{/gist_id}","starred_url":"https://api.github.com/users/sidane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sidane/subscriptions","organizations_url":"https://api.github.com/users/sidane/orgs","repos_url":"https://api.github.com/users/sidane/repos","events_url":"https://api.github.com/users/sidane/events{/privacy}","received_events_url":"https://api.github.com/users/sidane/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-02-22T14:16:14Z","updated_at":"2017-02-27T11:09:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/BritishBusinessBank/EFG/pulls/343","html_url":"https://github.com/BritishBusinessBank/EFG/pull/343","diff_url":"https://github.com/BritishBusinessBank/EFG/pull/343.diff","patch_url":"https://github.com/BritishBusinessBank/EFG/pull/343.patch"},"body":"Previously building a loan that needs to be in a specific state for a spec required combining many traits. Example:\r\n\r\n`create(:loan, :eligible, :completed, :offered, :guaranteed)`\r\n\r\nThis is both verbose and error prone as each state is dependent on attributes set in preceding states. If a trait is left out you will have an incomplete loan in your spec. Often this won’t matter but it has the potential to give false positive test results.\r\n\r\nThere is now a specific factory for each loan state, with these factories inheriting from the relevant parent factory. Examples:\r\n\r\n`create(:completed_loan)` (inherits from `:eligible_loan`)\r\n`build(:guaranteed_loan)` (inherits from `:offered_loan`)\r\n\r\nThis commit also includes a few tweaks to various factories and minor changes to some specs to work with the new factories."},"comment":{"url":"https://api.github.com/repos/BritishBusinessBank/EFG/issues/comments/282691906","html_url":"https://github.com/BritishBusinessBank/EFG/pull/343#issuecomment-282691906","issue_url":"https://api.github.com/repos/BritishBusinessBank/EFG/issues/343","id":282691906,"user":{"login":"sidane","id":53722,"avatar_url":"https://avatars.githubusercontent.com/u/53722?v=3","gravatar_id":"","url":"https://api.github.com/users/sidane","html_url":"https://github.com/sidane","followers_url":"https://api.github.com/users/sidane/followers","following_url":"https://api.github.com/users/sidane/following{/other_user}","gists_url":"https://api.github.com/users/sidane/gists{/gist_id}","starred_url":"https://api.github.com/users/sidane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sidane/subscriptions","organizations_url":"https://api.github.com/users/sidane/orgs","repos_url":"https://api.github.com/users/sidane/repos","events_url":"https://api.github.com/users/sidane/events{/privacy}","received_events_url":"https://api.github.com/users/sidane/received_events","type":"User","site_admin":false},"created_at":"2017-02-27T11:09:07Z","updated_at":"2017-02-27T11:09:07Z","body":"Thanks @tjmw. I like that middle ground of keeping the traits and defining explicit factories for each state. I'll do some further refactoring and see how it goes.\r\n\r\nYou're spot on about the cancelled state as well, it is possible to transition to `cancelled` from several different states."}}
{"actor":{"display_login":"sidane"}}