{"action":"created","comment":{"url":"https://api.github.com/repos/simonc/memfs/pulls/comments/47313776","id":47313776,"diff_hunk":"@@ -950,6 +950,30 @@ module MemFs\n       end\n     end\n \n+    describe '.write' do\n+      it 'writes the string to the given file' do\n+        described_class.write('/test-file', \"test\")","path":"spec/memfs/file_spec.rb","position":6,"original_position":6,"commit_id":"79c0143894f3b2e9e2f336222a9ce2ba585b4f46","original_commit_id":"79c0143894f3b2e9e2f336222a9ce2ba585b4f46","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.","created_at":"2015-12-11T01:53:01Z","updated_at":"2015-12-11T01:53:01Z","html_url":"https://github.com/simonc/memfs/pull/20#discussion_r47313776","pull_request_url":"https://api.github.com/repos/simonc/memfs/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/simonc/memfs/pulls/comments/47313776"},"html":{"href":"https://github.com/simonc/memfs/pull/20#discussion_r47313776"},"pull_request":{"href":"https://api.github.com/repos/simonc/memfs/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/simonc/memfs/pulls/20","id":53344415,"html_url":"https://github.com/simonc/memfs/pull/20","diff_url":"https://github.com/simonc/memfs/pull/20.diff","patch_url":"https://github.com/simonc/memfs/pull/20.patch","issue_url":"https://api.github.com/repos/simonc/memfs/issues/20","number":20,"state":"open","locked":false,"title":"NoMethodError: undefined method `write' for MemFs::File:Class","user":{"login":"rmm5t","id":740,"avatar_url":"https://avatars.githubusercontent.com/u/740?v=3","gravatar_id":"","url":"https://api.github.com/users/rmm5t","html_url":"https://github.com/rmm5t","followers_url":"https://api.github.com/users/rmm5t/followers","following_url":"https://api.github.com/users/rmm5t/following{/other_user}","gists_url":"https://api.github.com/users/rmm5t/gists{/gist_id}","starred_url":"https://api.github.com/users/rmm5t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmm5t/subscriptions","organizations_url":"https://api.github.com/users/rmm5t/orgs","repos_url":"https://api.github.com/users/rmm5t/repos","events_url":"https://api.github.com/users/rmm5t/events{/privacy}","received_events_url":"https://api.github.com/users/rmm5t/received_events","type":"User","site_admin":false},"body":"I know that the lack of a `IO.write` implementation is a known issue in the README still, but the more basic usage of it, typically written as `File.write(filename, string)`, is something that compliments the typical `File.read(filename)` quite nicely. \r\n\r\nIn my test suite, for now, I'm just manually adding a `MemFs::File.write` method to cover the usage I was using in my project.\r\n\r\n```ruby\r\nclass MemFs::File\r\n  # MemFs doesn't implement IO.write, because the base implementation allows\r\n  # for file offsets and other options, but it's quite convenient to be able\r\n  # to use File.write in its most basic use case, so let's simulate that.\r\n  def self.write(name, string, offset = nil, open_args = {})\r\n    File.open(name, \"w\") { |f| f.write(string) }\r\n  end\r\nend\r\n```\r\n\r\nI just wanted to open up a discussion about potentially implementing this in memfs. I understand that this is not a complete implementation. I also understand the complexities involved with fully implementing `offset` and `open_args` support.\r\n\r\nRight now, I'm at a cross-roads, because I ran into some semi-serious troubles with FakeFS and open-uri. I decided to try MemFs. It seems to work great so far, but I ran into this `File.write` hurdle. I'm now considering dropping a fake filesystem from my test suite altogether, but if I decide to keep MemFs around, I'd be willing to look deeper into a full PR here.\r\n\r\nIf this isn't worth doing, feel free to close this issue, but I wanted document this, open a discussion, and share (in case any one else might benefit from this).","created_at":"2015-12-11T01:52:51Z","updated_at":"2015-12-11T01:53:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e541eb79794914fdd114252bcafed810e929d0c8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/simonc/memfs/pulls/20/commits","review_comments_url":"https://api.github.com/repos/simonc/memfs/pulls/20/comments","review_comment_url":"https://api.github.com/repos/simonc/memfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/simonc/memfs/issues/20/comments","statuses_url":"https://api.github.com/repos/simonc/memfs/statuses/79c0143894f3b2e9e2f336222a9ce2ba585b4f46","head":{"label":"rmm5t:io-write","ref":"io-write","sha":"79c0143894f3b2e9e2f336222a9ce2ba585b4f46","user":{"login":"rmm5t","id":740,"avatar_url":"https://avatars.githubusercontent.com/u/740?v=3","gravatar_id":"","url":"https://api.github.com/users/rmm5t","html_url":"https://github.com/rmm5t","followers_url":"https://api.github.com/users/rmm5t/followers","following_url":"https://api.github.com/users/rmm5t/following{/other_user}","gists_url":"https://api.github.com/users/rmm5t/gists{/gist_id}","starred_url":"https://api.github.com/users/rmm5t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmm5t/subscriptions","organizations_url":"https://api.github.com/users/rmm5t/orgs","repos_url":"https://api.github.com/users/rmm5t/repos","events_url":"https://api.github.com/users/rmm5t/events{/privacy}","received_events_url":"https://api.github.com/users/rmm5t/received_events","type":"User","site_admin":false},"repo":{"id":47798621,"name":"memfs","full_name":"rmm5t/memfs","owner":{"login":"rmm5t","id":740,"avatar_url":"https://avatars.githubusercontent.com/u/740?v=3","gravatar_id":"","url":"https://api.github.com/users/rmm5t","html_url":"https://github.com/rmm5t","followers_url":"https://api.github.com/users/rmm5t/followers","following_url":"https://api.github.com/users/rmm5t/following{/other_user}","gists_url":"https://api.github.com/users/rmm5t/gists{/gist_id}","starred_url":"https://api.github.com/users/rmm5t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmm5t/subscriptions","organizations_url":"https://api.github.com/users/rmm5t/orgs","repos_url":"https://api.github.com/users/rmm5t/repos","events_url":"https://api.github.com/users/rmm5t/events{/privacy}","received_events_url":"https://api.github.com/users/rmm5t/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rmm5t/memfs","description":"MemFs provides a fake file system that can be used for tests. Strongly inspired by FakeFS.","fork":true,"url":"https://api.github.com/repos/rmm5t/memfs","forks_url":"https://api.github.com/repos/rmm5t/memfs/forks","keys_url":"https://api.github.com/repos/rmm5t/memfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rmm5t/memfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rmm5t/memfs/teams","hooks_url":"https://api.github.com/repos/rmm5t/memfs/hooks","issue_events_url":"https://api.github.com/repos/rmm5t/memfs/issues/events{/number}","events_url":"https://api.github.com/repos/rmm5t/memfs/events","assignees_url":"https://api.github.com/repos/rmm5t/memfs/assignees{/user}","branches_url":"https://api.github.com/repos/rmm5t/memfs/branches{/branch}","tags_url":"https://api.github.com/repos/rmm5t/memfs/tags","blobs_url":"https://api.github.com/repos/rmm5t/memfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rmm5t/memfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rmm5t/memfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/rmm5t/memfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rmm5t/memfs/statuses/{sha}","languages_url":"https://api.github.com/repos/rmm5t/memfs/languages","stargazers_url":"https://api.github.com/repos/rmm5t/memfs/stargazers","contributors_url":"https://api.github.com/repos/rmm5t/memfs/contributors","subscribers_url":"https://api.github.com/repos/rmm5t/memfs/subscribers","subscription_url":"https://api.github.com/repos/rmm5t/memfs/subscription","commits_url":"https://api.github.com/repos/rmm5t/memfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/rmm5t/memfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/rmm5t/memfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/rmm5t/memfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/rmm5t/memfs/contents/{+path}","compare_url":"https://api.github.com/repos/rmm5t/memfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rmm5t/memfs/merges","archive_url":"https://api.github.com/repos/rmm5t/memfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rmm5t/memfs/downloads","issues_url":"https://api.github.com/repos/rmm5t/memfs/issues{/number}","pulls_url":"https://api.github.com/repos/rmm5t/memfs/pulls{/number}","milestones_url":"https://api.github.com/repos/rmm5t/memfs/milestones{/number}","notifications_url":"https://api.github.com/repos/rmm5t/memfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rmm5t/memfs/labels{/name}","releases_url":"https://api.github.com/repos/rmm5t/memfs/releases{/id}","created_at":"2015-12-11T01:52:14Z","updated_at":"2015-12-11T01:52:15Z","pushed_at":"2015-12-11T01:52:39Z","git_url":"git://github.com/rmm5t/memfs.git","ssh_url":"git@github.com:rmm5t/memfs.git","clone_url":"https://github.com/rmm5t/memfs.git","svn_url":"https://github.com/rmm5t/memfs","homepage":null,"size":352,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"simonc:master","ref":"master","sha":"a05b5fda51b08e5a830e46a6cab7b7cfacefb9ff","user":{"login":"simonc","id":119303,"avatar_url":"https://avatars.githubusercontent.com/u/119303?v=3","gravatar_id":"","url":"https://api.github.com/users/simonc","html_url":"https://github.com/simonc","followers_url":"https://api.github.com/users/simonc/followers","following_url":"https://api.github.com/users/simonc/following{/other_user}","gists_url":"https://api.github.com/users/simonc/gists{/gist_id}","starred_url":"https://api.github.com/users/simonc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonc/subscriptions","organizations_url":"https://api.github.com/users/simonc/orgs","repos_url":"https://api.github.com/users/simonc/repos","events_url":"https://api.github.com/users/simonc/events{/privacy}","received_events_url":"https://api.github.com/users/simonc/received_events","type":"User","site_admin":false},"repo":{"id":10736758,"name":"memfs","full_name":"simonc/memfs","owner":{"login":"simonc","id":119303,"avatar_url":"https://avatars.githubusercontent.com/u/119303?v=3","gravatar_id":"","url":"https://api.github.com/users/simonc","html_url":"https://github.com/simonc","followers_url":"https://api.github.com/users/simonc/followers","following_url":"https://api.github.com/users/simonc/following{/other_user}","gists_url":"https://api.github.com/users/simonc/gists{/gist_id}","starred_url":"https://api.github.com/users/simonc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonc/subscriptions","organizations_url":"https://api.github.com/users/simonc/orgs","repos_url":"https://api.github.com/users/simonc/repos","events_url":"https://api.github.com/users/simonc/events{/privacy}","received_events_url":"https://api.github.com/users/simonc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/simonc/memfs","description":"MemFs provides a fake file system that can be used for tests. Strongly inspired by FakeFS.","fork":false,"url":"https://api.github.com/repos/simonc/memfs","forks_url":"https://api.github.com/repos/simonc/memfs/forks","keys_url":"https://api.github.com/repos/simonc/memfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/simonc/memfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/simonc/memfs/teams","hooks_url":"https://api.github.com/repos/simonc/memfs/hooks","issue_events_url":"https://api.github.com/repos/simonc/memfs/issues/events{/number}","events_url":"https://api.github.com/repos/simonc/memfs/events","assignees_url":"https://api.github.com/repos/simonc/memfs/assignees{/user}","branches_url":"https://api.github.com/repos/simonc/memfs/branches{/branch}","tags_url":"https://api.github.com/repos/simonc/memfs/tags","blobs_url":"https://api.github.com/repos/simonc/memfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/simonc/memfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/simonc/memfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/simonc/memfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/simonc/memfs/statuses/{sha}","languages_url":"https://api.github.com/repos/simonc/memfs/languages","stargazers_url":"https://api.github.com/repos/simonc/memfs/stargazers","contributors_url":"https://api.github.com/repos/simonc/memfs/contributors","subscribers_url":"https://api.github.com/repos/simonc/memfs/subscribers","subscription_url":"https://api.github.com/repos/simonc/memfs/subscription","commits_url":"https://api.github.com/repos/simonc/memfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/simonc/memfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/simonc/memfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/simonc/memfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/simonc/memfs/contents/{+path}","compare_url":"https://api.github.com/repos/simonc/memfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/simonc/memfs/merges","archive_url":"https://api.github.com/repos/simonc/memfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/simonc/memfs/downloads","issues_url":"https://api.github.com/repos/simonc/memfs/issues{/number}","pulls_url":"https://api.github.com/repos/simonc/memfs/pulls{/number}","milestones_url":"https://api.github.com/repos/simonc/memfs/milestones{/number}","notifications_url":"https://api.github.com/repos/simonc/memfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/simonc/memfs/labels{/name}","releases_url":"https://api.github.com/repos/simonc/memfs/releases{/id}","created_at":"2013-06-17T12:24:07Z","updated_at":"2015-12-09T00:32:33Z","pushed_at":"2015-12-11T01:52:52Z","git_url":"git://github.com/simonc/memfs.git","ssh_url":"git@github.com:simonc/memfs.git","clone_url":"https://github.com/simonc/memfs.git","svn_url":"https://github.com/simonc/memfs","homepage":null,"size":859,"stargazers_count":251,"watchers_count":251,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":6,"forks":12,"open_issues":6,"watchers":251,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/simonc/memfs/pulls/20"},"html":{"href":"https://github.com/simonc/memfs/pull/20"},"issue":{"href":"https://api.github.com/repos/simonc/memfs/issues/20"},"comments":{"href":"https://api.github.com/repos/simonc/memfs/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/simonc/memfs/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/simonc/memfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/simonc/memfs/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/simonc/memfs/statuses/79c0143894f3b2e9e2f336222a9ce2ba585b4f46"}}}}