{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/rspec-sequencing/pulls/comments/49187939","id":49187939,"diff_hunk":"@@ -1,2 +1,91 @@\n-# rspec-sequencing\n-Define sequenced actions that simulate real-world scenarios, e.g write_file then 2 seconds later rename it\n+# Rspec::Sequencing\n+\n+Define sequenced actions that simulate real-world scenarios, e.g. write_file then 2 seconds later rename it or execute a sequence of actions on a http server\n+\n+## Installation\n+\n+Add this line to your application's Gemfile:\n+\n+```ruby\n+gem 'rspec-sequencing'\n+```\n+\n+And then execute:\n+\n+    $ bundle\n+\n+Or install it yourself as:\n+\n+    $ gem install rspec-sequencing\n+\n+## Usage\n+\n+Generally one would use this when you need to have a series of actions occur in way that reflects the real world in terms of being asynchronous, serial, and spread out over time especially when the library code you are testing has difficult to mock dependencies like sockets, files, servers or apis, i.e. integration testing.\n+\n+Add `require \"rspec_sequencing\"` in your spec_helper.rb or equivalent.\n+\n+In your example group you can define a sequence in a before block or a let block.  If you use a let block, then you should call the activate method on the sequence to get RSpec to create it. Call activate in a before block or in the example.\n+\n+e.g. from the ruby-filewatch gem watch_spec.rb\n+```ruby\n+  context \"when watching a directory with files\" do\n+    let(:actions) do\n+      RSpec::Sequencing\n+        .run(\"create file\") do\n+          File.open(file_path, \"wb\") { |file|  file.write(\"line1\\nline2\\n\") }\n+        end\n+        .then_after(0.25, \"start watching when directory has files\") do\n+          subject.watch(File.join(directory, \"*.log\"))\n+        end\n+        .then_after(0.55, \"quit after a short time\") do\n+          subject.quit # <- unblocks the RSpec thread\n+        end\n+    end\n+\n+    it \"yields create_initial and one modify file events\" do\n+      actions.activate\n+      subscribe_proc.call # <- blocks the RSpec thread\n+      expect(results).to eq([[:create_initial, file_path], [:modify, file_path]])","path":"README.md","position":50,"original_position":50,"commit_id":"9f17d0df61507cb106e327c2a5fd2aa7d6d8c453","original_commit_id":"9f17d0df61507cb106e327c2a5fd2aa7d6d8c453","user":{"login":"purbon","id":68540,"avatar_url":"https://avatars.githubusercontent.com/u/68540?v=3","gravatar_id":"","url":"https://api.github.com/users/purbon","html_url":"https://github.com/purbon","followers_url":"https://api.github.com/users/purbon/followers","following_url":"https://api.github.com/users/purbon/following{/other_user}","gists_url":"https://api.github.com/users/purbon/gists{/gist_id}","starred_url":"https://api.github.com/users/purbon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purbon/subscriptions","organizations_url":"https://api.github.com/users/purbon/orgs","repos_url":"https://api.github.com/users/purbon/repos","events_url":"https://api.github.com/users/purbon/events{/privacy}","received_events_url":"https://api.github.com/users/purbon/received_events","type":"User","site_admin":false},"body":"What do you think about, wrapping this functionality with a custom matcher? my concern here is about hiding things like activate and the need to block the rspec thread from users. What do you think?","created_at":"2016-01-08T13:35:49Z","updated_at":"2016-01-08T13:35:49Z","html_url":"https://github.com/elastic/rspec-sequencing/pull/1#discussion_r49187939","pull_request_url":"https://api.github.com/repos/elastic/rspec-sequencing/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/elastic/rspec-sequencing/pulls/comments/49187939"},"html":{"href":"https://github.com/elastic/rspec-sequencing/pull/1#discussion_r49187939"},"pull_request":{"href":"https://api.github.com/repos/elastic/rspec-sequencing/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/rspec-sequencing/pulls/1","id":55456526,"html_url":"https://github.com/elastic/rspec-sequencing/pull/1","diff_url":"https://github.com/elastic/rspec-sequencing/pull/1.diff","patch_url":"https://github.com/elastic/rspec-sequencing/pull/1.patch","issue_url":"https://api.github.com/repos/elastic/rspec-sequencing/issues/1","number":1,"state":"open","locked":false,"title":"First release","user":{"login":"guyboertje","id":84912,"avatar_url":"https://avatars.githubusercontent.com/u/84912?v=3","gravatar_id":"","url":"https://api.github.com/users/guyboertje","html_url":"https://github.com/guyboertje","followers_url":"https://api.github.com/users/guyboertje/followers","following_url":"https://api.github.com/users/guyboertje/following{/other_user}","gists_url":"https://api.github.com/users/guyboertje/gists{/gist_id}","starred_url":"https://api.github.com/users/guyboertje/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guyboertje/subscriptions","organizations_url":"https://api.github.com/users/guyboertje/orgs","repos_url":"https://api.github.com/users/guyboertje/repos","events_url":"https://api.github.com/users/guyboertje/events{/privacy}","received_events_url":"https://api.github.com/users/guyboertje/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-08T12:28:58Z","updated_at":"2016-01-08T13:35:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d3515c75e8b6143a9dd2df347dfc580c5dc911b7","assignee":{"login":"purbon","id":68540,"avatar_url":"https://avatars.githubusercontent.com/u/68540?v=3","gravatar_id":"","url":"https://api.github.com/users/purbon","html_url":"https://github.com/purbon","followers_url":"https://api.github.com/users/purbon/followers","following_url":"https://api.github.com/users/purbon/following{/other_user}","gists_url":"https://api.github.com/users/purbon/gists{/gist_id}","starred_url":"https://api.github.com/users/purbon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purbon/subscriptions","organizations_url":"https://api.github.com/users/purbon/orgs","repos_url":"https://api.github.com/users/purbon/repos","events_url":"https://api.github.com/users/purbon/events{/privacy}","received_events_url":"https://api.github.com/users/purbon/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/elastic/rspec-sequencing/pulls/1/commits","review_comments_url":"https://api.github.com/repos/elastic/rspec-sequencing/pulls/1/comments","review_comment_url":"https://api.github.com/repos/elastic/rspec-sequencing/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/rspec-sequencing/issues/1/comments","statuses_url":"https://api.github.com/repos/elastic/rspec-sequencing/statuses/9f17d0df61507cb106e327c2a5fd2aa7d6d8c453","head":{"label":"guyboertje:first_draft","ref":"first_draft","sha":"9f17d0df61507cb106e327c2a5fd2aa7d6d8c453","user":{"login":"guyboertje","id":84912,"avatar_url":"https://avatars.githubusercontent.com/u/84912?v=3","gravatar_id":"","url":"https://api.github.com/users/guyboertje","html_url":"https://github.com/guyboertje","followers_url":"https://api.github.com/users/guyboertje/followers","following_url":"https://api.github.com/users/guyboertje/following{/other_user}","gists_url":"https://api.github.com/users/guyboertje/gists{/gist_id}","starred_url":"https://api.github.com/users/guyboertje/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guyboertje/subscriptions","organizations_url":"https://api.github.com/users/guyboertje/orgs","repos_url":"https://api.github.com/users/guyboertje/repos","events_url":"https://api.github.com/users/guyboertje/events{/privacy}","received_events_url":"https://api.github.com/users/guyboertje/received_events","type":"User","site_admin":false},"repo":{"id":49129406,"name":"rspec-sequencing","full_name":"guyboertje/rspec-sequencing","owner":{"login":"guyboertje","id":84912,"avatar_url":"https://avatars.githubusercontent.com/u/84912?v=3","gravatar_id":"","url":"https://api.github.com/users/guyboertje","html_url":"https://github.com/guyboertje","followers_url":"https://api.github.com/users/guyboertje/followers","following_url":"https://api.github.com/users/guyboertje/following{/other_user}","gists_url":"https://api.github.com/users/guyboertje/gists{/gist_id}","starred_url":"https://api.github.com/users/guyboertje/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guyboertje/subscriptions","organizations_url":"https://api.github.com/users/guyboertje/orgs","repos_url":"https://api.github.com/users/guyboertje/repos","events_url":"https://api.github.com/users/guyboertje/events{/privacy}","received_events_url":"https://api.github.com/users/guyboertje/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/guyboertje/rspec-sequencing","description":"Define sequenced actions that simulate real-world scenarios, e.g write_file then 2 seconds later rename it","fork":true,"url":"https://api.github.com/repos/guyboertje/rspec-sequencing","forks_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/forks","keys_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/teams","hooks_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/hooks","issue_events_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/issues/events{/number}","events_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/events","assignees_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/assignees{/user}","branches_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/branches{/branch}","tags_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/tags","blobs_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/git/refs{/sha}","trees_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/statuses/{sha}","languages_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/languages","stargazers_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/stargazers","contributors_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/contributors","subscribers_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/subscribers","subscription_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/subscription","commits_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/commits{/sha}","git_commits_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/git/commits{/sha}","comments_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/comments{/number}","issue_comment_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/issues/comments{/number}","contents_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/contents/{+path}","compare_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/merges","archive_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/downloads","issues_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/issues{/number}","pulls_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/pulls{/number}","milestones_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/milestones{/number}","notifications_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/labels{/name}","releases_url":"https://api.github.com/repos/guyboertje/rspec-sequencing/releases{/id}","created_at":"2016-01-06T10:45:14Z","updated_at":"2016-01-06T10:45:03Z","pushed_at":"2016-01-08T12:27:34Z","git_url":"git://github.com/guyboertje/rspec-sequencing.git","ssh_url":"git@github.com:guyboertje/rspec-sequencing.git","clone_url":"https://github.com/guyboertje/rspec-sequencing.git","svn_url":"https://github.com/guyboertje/rspec-sequencing","homepage":null,"size":10,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"fd450e710c628928a2e9112bd11fa5be493c943c","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":49129401,"name":"rspec-sequencing","full_name":"elastic/rspec-sequencing","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/rspec-sequencing","description":"Define sequenced actions that simulate real-world scenarios, e.g write_file then 2 seconds later rename it","fork":false,"url":"https://api.github.com/repos/elastic/rspec-sequencing","forks_url":"https://api.github.com/repos/elastic/rspec-sequencing/forks","keys_url":"https://api.github.com/repos/elastic/rspec-sequencing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/rspec-sequencing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/rspec-sequencing/teams","hooks_url":"https://api.github.com/repos/elastic/rspec-sequencing/hooks","issue_events_url":"https://api.github.com/repos/elastic/rspec-sequencing/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/rspec-sequencing/events","assignees_url":"https://api.github.com/repos/elastic/rspec-sequencing/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/rspec-sequencing/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/rspec-sequencing/tags","blobs_url":"https://api.github.com/repos/elastic/rspec-sequencing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/rspec-sequencing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/rspec-sequencing/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/rspec-sequencing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/rspec-sequencing/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/rspec-sequencing/languages","stargazers_url":"https://api.github.com/repos/elastic/rspec-sequencing/stargazers","contributors_url":"https://api.github.com/repos/elastic/rspec-sequencing/contributors","subscribers_url":"https://api.github.com/repos/elastic/rspec-sequencing/subscribers","subscription_url":"https://api.github.com/repos/elastic/rspec-sequencing/subscription","commits_url":"https://api.github.com/repos/elastic/rspec-sequencing/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/rspec-sequencing/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/rspec-sequencing/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/rspec-sequencing/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/rspec-sequencing/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/rspec-sequencing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/rspec-sequencing/merges","archive_url":"https://api.github.com/repos/elastic/rspec-sequencing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/rspec-sequencing/downloads","issues_url":"https://api.github.com/repos/elastic/rspec-sequencing/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/rspec-sequencing/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/rspec-sequencing/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/rspec-sequencing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/rspec-sequencing/labels{/name}","releases_url":"https://api.github.com/repos/elastic/rspec-sequencing/releases{/id}","created_at":"2016-01-06T10:45:03Z","updated_at":"2016-01-06T10:45:03Z","pushed_at":"2016-01-08T12:28:58Z","git_url":"git://github.com/elastic/rspec-sequencing.git","ssh_url":"git@github.com:elastic/rspec-sequencing.git","clone_url":"https://github.com/elastic/rspec-sequencing.git","svn_url":"https://github.com/elastic/rspec-sequencing","homepage":null,"size":4,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"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/elastic/rspec-sequencing/pulls/1"},"html":{"href":"https://github.com/elastic/rspec-sequencing/pull/1"},"issue":{"href":"https://api.github.com/repos/elastic/rspec-sequencing/issues/1"},"comments":{"href":"https://api.github.com/repos/elastic/rspec-sequencing/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/rspec-sequencing/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/rspec-sequencing/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/rspec-sequencing/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/rspec-sequencing/statuses/9f17d0df61507cb106e327c2a5fd2aa7d6d8c453"}}}}