{"action":"created","comment":{"url":"https://api.github.com/repos/huydx/scala_school/pulls/comments/40794127","id":40794127,"diff_hunk":"@@ -0,0 +1,317 @@\n+---\n+prev: coll2.textile\n+next: concurrency.textile\n+title: Testing with specs\n+layout: post\n+---\n+\n+Bài học sẽ hướng dẫn một số phương pháp kiểm thử bằng Specs - một Dehavior-Driven Design (BDD) Framework cho Scala.\n+\n+* \"kế thừa lớp Specification\":#example\n+** nested examples\n+* \"Mô hình thực thi - Execution Model\":#scope\n+* \"Cài dặt và gỡ bõ - Setup and TearDown\":#setup\n+** doFirst\n+** doBefore\n+** doAfter\n+* \"Matchers\":#matchers\n+** mustEqual\n+** contains\n+** sameSize?\n+** Viết Matchers của riêng bạn\n+* \"Mocks\":#mocks\n+* \"Spies\":#spies\n+* \"thực thi với sbt\":#sbt\n+\n+\n+h2(#example). Kế thừa lớp Specification\n+\n+Ta hãy bắt đầu với ví dụ dưới đây.\n+\n+<pre>\n+import org.specs._\n+\n+object ArithmeticSpec extends Specification {\n+  \"Arithmetic\" should {\n+    \"add two numbers\" in {\n+      1 + 1 mustEqual 2\n+    }\n+    \"add three numbers\" in {\n+      1 + 1 + 1 mustEqual 3\n+    }\n+  }\n+}\n+</pre>\n+\n+*Lưu ý* các thuật ngữ dưới đây là các từ chuyên môn của BDD, vì vậy tôi sẽ để nguyên để bạn đọc tiện theo dõi.\n+*Arithmetic* là *System Under Specification*\n+\n+*add* là một context.\n+\n+*add two numbers* và *add three numbers* là các examples.\n+","path":"web/vn/specs.textilevn","position":52,"original_position":52,"commit_id":"0f813cc32c1343f1f445304aecd84652b22d5076","original_commit_id":"0f813cc32c1343f1f445304aecd84652b22d5076","user":{"login":"huydx","id":535718,"avatar_url":"https://avatars.githubusercontent.com/u/535718?v=3","gravatar_id":"","url":"https://api.github.com/users/huydx","html_url":"https://github.com/huydx","followers_url":"https://api.github.com/users/huydx/followers","following_url":"https://api.github.com/users/huydx/following{/other_user}","gists_url":"https://api.github.com/users/huydx/gists{/gist_id}","starred_url":"https://api.github.com/users/huydx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huydx/subscriptions","organizations_url":"https://api.github.com/users/huydx/orgs","repos_url":"https://api.github.com/users/huydx/repos","events_url":"https://api.github.com/users/huydx/events{/privacy}","received_events_url":"https://api.github.com/users/huydx/received_events","type":"User","site_admin":false},"body":"anh nghĩ expectation nên dịch ra tiếng việt, với ghi chú ở trên là expectation còn là kí tự của BDD thì sẽ tốt hơn ","created_at":"2015-09-30T13:42:41Z","updated_at":"2015-09-30T13:42:41Z","html_url":"https://github.com/huydx/scala_school/pull/1#discussion_r40794127","pull_request_url":"https://api.github.com/repos/huydx/scala_school/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/huydx/scala_school/pulls/comments/40794127"},"html":{"href":"https://github.com/huydx/scala_school/pull/1#discussion_r40794127"},"pull_request":{"href":"https://api.github.com/repos/huydx/scala_school/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/huydx/scala_school/pulls/1","id":45629557,"html_url":"https://github.com/huydx/scala_school/pull/1","diff_url":"https://github.com/huydx/scala_school/pull/1.diff","patch_url":"https://github.com/huydx/scala_school/pull/1.patch","issue_url":"https://api.github.com/repos/huydx/scala_school/issues/1","number":1,"state":"open","locked":false,"title":"translated specs to Vietnamese","user":{"login":"phucnh","id":1061090,"avatar_url":"https://avatars.githubusercontent.com/u/1061090?v=3","gravatar_id":"","url":"https://api.github.com/users/phucnh","html_url":"https://github.com/phucnh","followers_url":"https://api.github.com/users/phucnh/followers","following_url":"https://api.github.com/users/phucnh/following{/other_user}","gists_url":"https://api.github.com/users/phucnh/gists{/gist_id}","starred_url":"https://api.github.com/users/phucnh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phucnh/subscriptions","organizations_url":"https://api.github.com/users/phucnh/orgs","repos_url":"https://api.github.com/users/phucnh/repos","events_url":"https://api.github.com/users/phucnh/events{/privacy}","received_events_url":"https://api.github.com/users/phucnh/received_events","type":"User","site_admin":false},"body":"Translated specs to Vietnamese\r\n\r\n### TODO\r\n- [x] check generated html file.","created_at":"2015-09-22T06:09:19Z","updated_at":"2015-09-30T13:42:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac635c6406b20b3d4cc0588fceb3445bf4007547","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/huydx/scala_school/pulls/1/commits","review_comments_url":"https://api.github.com/repos/huydx/scala_school/pulls/1/comments","review_comment_url":"https://api.github.com/repos/huydx/scala_school/pulls/comments{/number}","comments_url":"https://api.github.com/repos/huydx/scala_school/issues/1/comments","statuses_url":"https://api.github.com/repos/huydx/scala_school/statuses/0f813cc32c1343f1f445304aecd84652b22d5076","head":{"label":"phucnh:translate-specs-to-vietnamese","ref":"translate-specs-to-vietnamese","sha":"0f813cc32c1343f1f445304aecd84652b22d5076","user":{"login":"phucnh","id":1061090,"avatar_url":"https://avatars.githubusercontent.com/u/1061090?v=3","gravatar_id":"","url":"https://api.github.com/users/phucnh","html_url":"https://github.com/phucnh","followers_url":"https://api.github.com/users/phucnh/followers","following_url":"https://api.github.com/users/phucnh/following{/other_user}","gists_url":"https://api.github.com/users/phucnh/gists{/gist_id}","starred_url":"https://api.github.com/users/phucnh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phucnh/subscriptions","organizations_url":"https://api.github.com/users/phucnh/orgs","repos_url":"https://api.github.com/users/phucnh/repos","events_url":"https://api.github.com/users/phucnh/events{/privacy}","received_events_url":"https://api.github.com/users/phucnh/received_events","type":"User","site_admin":false},"repo":{"id":42877954,"name":"scala_school","full_name":"phucnh/scala_school","owner":{"login":"phucnh","id":1061090,"avatar_url":"https://avatars.githubusercontent.com/u/1061090?v=3","gravatar_id":"","url":"https://api.github.com/users/phucnh","html_url":"https://github.com/phucnh","followers_url":"https://api.github.com/users/phucnh/followers","following_url":"https://api.github.com/users/phucnh/following{/other_user}","gists_url":"https://api.github.com/users/phucnh/gists{/gist_id}","starred_url":"https://api.github.com/users/phucnh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phucnh/subscriptions","organizations_url":"https://api.github.com/users/phucnh/orgs","repos_url":"https://api.github.com/users/phucnh/repos","events_url":"https://api.github.com/users/phucnh/events{/privacy}","received_events_url":"https://api.github.com/users/phucnh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/phucnh/scala_school","description":"Lessons in the Fundamentals of Scala","fork":true,"url":"https://api.github.com/repos/phucnh/scala_school","forks_url":"https://api.github.com/repos/phucnh/scala_school/forks","keys_url":"https://api.github.com/repos/phucnh/scala_school/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phucnh/scala_school/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phucnh/scala_school/teams","hooks_url":"https://api.github.com/repos/phucnh/scala_school/hooks","issue_events_url":"https://api.github.com/repos/phucnh/scala_school/issues/events{/number}","events_url":"https://api.github.com/repos/phucnh/scala_school/events","assignees_url":"https://api.github.com/repos/phucnh/scala_school/assignees{/user}","branches_url":"https://api.github.com/repos/phucnh/scala_school/branches{/branch}","tags_url":"https://api.github.com/repos/phucnh/scala_school/tags","blobs_url":"https://api.github.com/repos/phucnh/scala_school/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phucnh/scala_school/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phucnh/scala_school/git/refs{/sha}","trees_url":"https://api.github.com/repos/phucnh/scala_school/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phucnh/scala_school/statuses/{sha}","languages_url":"https://api.github.com/repos/phucnh/scala_school/languages","stargazers_url":"https://api.github.com/repos/phucnh/scala_school/stargazers","contributors_url":"https://api.github.com/repos/phucnh/scala_school/contributors","subscribers_url":"https://api.github.com/repos/phucnh/scala_school/subscribers","subscription_url":"https://api.github.com/repos/phucnh/scala_school/subscription","commits_url":"https://api.github.com/repos/phucnh/scala_school/commits{/sha}","git_commits_url":"https://api.github.com/repos/phucnh/scala_school/git/commits{/sha}","comments_url":"https://api.github.com/repos/phucnh/scala_school/comments{/number}","issue_comment_url":"https://api.github.com/repos/phucnh/scala_school/issues/comments{/number}","contents_url":"https://api.github.com/repos/phucnh/scala_school/contents/{+path}","compare_url":"https://api.github.com/repos/phucnh/scala_school/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phucnh/scala_school/merges","archive_url":"https://api.github.com/repos/phucnh/scala_school/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phucnh/scala_school/downloads","issues_url":"https://api.github.com/repos/phucnh/scala_school/issues{/number}","pulls_url":"https://api.github.com/repos/phucnh/scala_school/pulls{/number}","milestones_url":"https://api.github.com/repos/phucnh/scala_school/milestones{/number}","notifications_url":"https://api.github.com/repos/phucnh/scala_school/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phucnh/scala_school/labels{/name}","releases_url":"https://api.github.com/repos/phucnh/scala_school/releases{/id}","created_at":"2015-09-21T16:13:12Z","updated_at":"2015-09-21T16:13:13Z","pushed_at":"2015-09-22T17:56:36Z","git_url":"git://github.com/phucnh/scala_school.git","ssh_url":"git@github.com:phucnh/scala_school.git","clone_url":"https://github.com/phucnh/scala_school.git","svn_url":"https://github.com/phucnh/scala_school","homepage":"http://twitter.github.com/scala_school","size":91131,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"huydx:master","ref":"master","sha":"fe5978c219c5a27597d36d7c451de9956db8ac49","user":{"login":"huydx","id":535718,"avatar_url":"https://avatars.githubusercontent.com/u/535718?v=3","gravatar_id":"","url":"https://api.github.com/users/huydx","html_url":"https://github.com/huydx","followers_url":"https://api.github.com/users/huydx/followers","following_url":"https://api.github.com/users/huydx/following{/other_user}","gists_url":"https://api.github.com/users/huydx/gists{/gist_id}","starred_url":"https://api.github.com/users/huydx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huydx/subscriptions","organizations_url":"https://api.github.com/users/huydx/orgs","repos_url":"https://api.github.com/users/huydx/repos","events_url":"https://api.github.com/users/huydx/events{/privacy}","received_events_url":"https://api.github.com/users/huydx/received_events","type":"User","site_admin":false},"repo":{"id":42875405,"name":"scala_school","full_name":"huydx/scala_school","owner":{"login":"huydx","id":535718,"avatar_url":"https://avatars.githubusercontent.com/u/535718?v=3","gravatar_id":"","url":"https://api.github.com/users/huydx","html_url":"https://github.com/huydx","followers_url":"https://api.github.com/users/huydx/followers","following_url":"https://api.github.com/users/huydx/following{/other_user}","gists_url":"https://api.github.com/users/huydx/gists{/gist_id}","starred_url":"https://api.github.com/users/huydx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huydx/subscriptions","organizations_url":"https://api.github.com/users/huydx/orgs","repos_url":"https://api.github.com/users/huydx/repos","events_url":"https://api.github.com/users/huydx/events{/privacy}","received_events_url":"https://api.github.com/users/huydx/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/huydx/scala_school","description":"Lessons in the Fundamentals of Scala","fork":true,"url":"https://api.github.com/repos/huydx/scala_school","forks_url":"https://api.github.com/repos/huydx/scala_school/forks","keys_url":"https://api.github.com/repos/huydx/scala_school/keys{/key_id}","collaborators_url":"https://api.github.com/repos/huydx/scala_school/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/huydx/scala_school/teams","hooks_url":"https://api.github.com/repos/huydx/scala_school/hooks","issue_events_url":"https://api.github.com/repos/huydx/scala_school/issues/events{/number}","events_url":"https://api.github.com/repos/huydx/scala_school/events","assignees_url":"https://api.github.com/repos/huydx/scala_school/assignees{/user}","branches_url":"https://api.github.com/repos/huydx/scala_school/branches{/branch}","tags_url":"https://api.github.com/repos/huydx/scala_school/tags","blobs_url":"https://api.github.com/repos/huydx/scala_school/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/huydx/scala_school/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/huydx/scala_school/git/refs{/sha}","trees_url":"https://api.github.com/repos/huydx/scala_school/git/trees{/sha}","statuses_url":"https://api.github.com/repos/huydx/scala_school/statuses/{sha}","languages_url":"https://api.github.com/repos/huydx/scala_school/languages","stargazers_url":"https://api.github.com/repos/huydx/scala_school/stargazers","contributors_url":"https://api.github.com/repos/huydx/scala_school/contributors","subscribers_url":"https://api.github.com/repos/huydx/scala_school/subscribers","subscription_url":"https://api.github.com/repos/huydx/scala_school/subscription","commits_url":"https://api.github.com/repos/huydx/scala_school/commits{/sha}","git_commits_url":"https://api.github.com/repos/huydx/scala_school/git/commits{/sha}","comments_url":"https://api.github.com/repos/huydx/scala_school/comments{/number}","issue_comment_url":"https://api.github.com/repos/huydx/scala_school/issues/comments{/number}","contents_url":"https://api.github.com/repos/huydx/scala_school/contents/{+path}","compare_url":"https://api.github.com/repos/huydx/scala_school/compare/{base}...{head}","merges_url":"https://api.github.com/repos/huydx/scala_school/merges","archive_url":"https://api.github.com/repos/huydx/scala_school/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/huydx/scala_school/downloads","issues_url":"https://api.github.com/repos/huydx/scala_school/issues{/number}","pulls_url":"https://api.github.com/repos/huydx/scala_school/pulls{/number}","milestones_url":"https://api.github.com/repos/huydx/scala_school/milestones{/number}","notifications_url":"https://api.github.com/repos/huydx/scala_school/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/huydx/scala_school/labels{/name}","releases_url":"https://api.github.com/repos/huydx/scala_school/releases{/id}","created_at":"2015-09-21T15:32:38Z","updated_at":"2015-09-21T15:32:39Z","pushed_at":"2015-09-22T17:56:37Z","git_url":"git://github.com/huydx/scala_school.git","ssh_url":"git@github.com:huydx/scala_school.git","clone_url":"https://github.com/huydx/scala_school.git","svn_url":"https://github.com/huydx/scala_school","homepage":"http://twitter.github.com/scala_school","size":91197,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/huydx/scala_school/pulls/1"},"html":{"href":"https://github.com/huydx/scala_school/pull/1"},"issue":{"href":"https://api.github.com/repos/huydx/scala_school/issues/1"},"comments":{"href":"https://api.github.com/repos/huydx/scala_school/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/huydx/scala_school/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/huydx/scala_school/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/huydx/scala_school/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/huydx/scala_school/statuses/0f813cc32c1343f1f445304aecd84652b22d5076"}}}}