{"action":"created","issue":{"url":"https://api.github.com/repos/vektra/mockery/issues/192","repository_url":"https://api.github.com/repos/vektra/mockery","labels_url":"https://api.github.com/repos/vektra/mockery/issues/192/labels{/name}","comments_url":"https://api.github.com/repos/vektra/mockery/issues/192/comments","events_url":"https://api.github.com/repos/vektra/mockery/issues/192/events","html_url":"https://github.com/vektra/mockery/issues/192","id":310442565,"node_id":"MDU6SXNzdWUzMTA0NDI1NjU=","number":192,"title":"Add method names as constants","user":{"login":"GhostRussia","id":12181586,"node_id":"MDQ6VXNlcjEyMTgxNTg2","avatar_url":"https://avatars0.githubusercontent.com/u/12181586?v=4","gravatar_id":"","url":"https://api.github.com/users/GhostRussia","html_url":"https://github.com/GhostRussia","followers_url":"https://api.github.com/users/GhostRussia/followers","following_url":"https://api.github.com/users/GhostRussia/following{/other_user}","gists_url":"https://api.github.com/users/GhostRussia/gists{/gist_id}","starred_url":"https://api.github.com/users/GhostRussia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GhostRussia/subscriptions","organizations_url":"https://api.github.com/users/GhostRussia/orgs","repos_url":"https://api.github.com/users/GhostRussia/repos","events_url":"https://api.github.com/users/GhostRussia/events{/privacy}","received_events_url":"https://api.github.com/users/GhostRussia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-02T09:42:44Z","updated_at":"2018-07-02T14:52:22Z","closed_at":null,"author_association":"NONE","body":"Example:\r\n```go\r\n\timage := new(mocks.Image)\r\n-\timage.On(\"Add\", mock.Anything)\r\n+\timage.On(mocks.ImageMethodAdd, mock.Anything)\r\n```\r\n\r\n```go\r\ntype Image struct {\r\n\tmock.Mock\r\n}\r\n\r\n+ const (\r\n+ \tImageMethodAdd = \"Add\"\r\n+ \tImageMethodGet = \"Get\"\r\n+ )\r\n\r\nfunc (_m *Image) Add(image model.Image) (uint64, error) {}\r\nfunc (_m *Image) Get(settings storage.SettingsImage) ([]model.Image, error) {}\r\n...\r\n```"},"comment":{"url":"https://api.github.com/repos/vektra/mockery/issues/comments/401832024","html_url":"https://github.com/vektra/mockery/issues/192#issuecomment-401832024","issue_url":"https://api.github.com/repos/vektra/mockery/issues/192","id":401832024,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTgzMjAyNA==","user":{"login":"GhostRussia","id":12181586,"node_id":"MDQ6VXNlcjEyMTgxNTg2","avatar_url":"https://avatars0.githubusercontent.com/u/12181586?v=4","gravatar_id":"","url":"https://api.github.com/users/GhostRussia","html_url":"https://github.com/GhostRussia","followers_url":"https://api.github.com/users/GhostRussia/followers","following_url":"https://api.github.com/users/GhostRussia/following{/other_user}","gists_url":"https://api.github.com/users/GhostRussia/gists{/gist_id}","starred_url":"https://api.github.com/users/GhostRussia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GhostRussia/subscriptions","organizations_url":"https://api.github.com/users/GhostRussia/orgs","repos_url":"https://api.github.com/users/GhostRussia/repos","events_url":"https://api.github.com/users/GhostRussia/events{/privacy}","received_events_url":"https://api.github.com/users/GhostRussia/received_events","type":"User","site_admin":false},"created_at":"2018-07-02T14:52:22Z","updated_at":"2018-07-02T14:52:22Z","author_association":"NONE","body":"@tutukin In this case, the restrictions are related to the library that is used for mocks\r\nhttps://github.com/stretchr/testify#mock-package\r\n\r\nFor example, in another [library](\r\nhttps://github.com/petergtz/pegomock) implemented as:\r\n```go\r\nphoneBook := NewMockPhoneBook()\r\n\r\n// Stubbing:\r\npegomock.When(phoneBook.GetPhoneNumber(AnyString())).Then(func(params []Param) ReturnValues {\r\n\treturn []ReturnValue{fmt.Sprintf(\"1-800-CALL-%v\", strings.ToUpper(params[0]))}\r\n},\r\n// or\r\npegomock.When(phoneBook.GetPhoneNumber(\"Tom\")).ThenReturn(\"345-123-789\")\r\n\r\n// Prints \"1-800-CALL-DAN\":\r\nfmt.Println(phoneBook.GetPhoneNumber(\"Dan\"))\r\nphoneBook.VerifyWasCalledOnce().GetPhoneNumber(\"Tom\")\r\n```"}}
{"actor":{"display_login":"GhostRussia"}}