fakefs 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab9dd088d6839ddeba02aaf46e1dc61c7e216d9b
4
- data.tar.gz: e3d10c9ea2081d92bc894430831b3eaaef00cc04
3
+ metadata.gz: b9f9df4a437b257a48a59a49e7a5c5a04ab1bbe6
4
+ data.tar.gz: ed42685cfdae7eebeafb2069e3055c298bd189c9
5
5
  SHA512:
6
- metadata.gz: 0a82f01ee54e4821e0b0b50a1cb5d586baf5569b2d6945e0c5e19e5c05d850ae2600b0dae31222eb86b59dc73528c99b0f5fa0494900953d0eb40c7de9b11d5f
7
- data.tar.gz: 45ab743b9d6c0c8518d6054f2c7d2d68a0f40f8d82b62990044d7c7a9a0a4bd6347f1cc5befce2ddccc8b9d2595aee090f639df50c1e8a7d551502691c334093
6
+ metadata.gz: cf1309391825fafa8ae30e35a52e8703faa55531da6140b777cc10d3302e978a2e7643140cac02b278d5348114232d78429aaafa9bd542894781a2f8ad90c53c
7
+ data.tar.gz: cca5b5206a5d8c09bcbdab4d8a06a6510fb80c7aa6e2446c30169f0209e0a15c066060cb1e201d55054913e2e33866868ea4f013e062b4038fedcedd59044dc8
@@ -1,4 +1,4 @@
1
- FakeFS [![build status](https://secure.travis-ci.org/defunkt/fakefs.svg?branch=master)](https://secure.travis-ci.org/defunkt/fakefs)
1
+ FakeFS [![build status](https://travis-ci.org/fakefs/fakefs.svg?branch=master)](https://travis-ci.org/fakefs/fakefs)
2
2
  ======
3
3
 
4
4
  Mocking calls to FileUtils or File means tightly coupling tests with the implementation.
@@ -10,7 +10,7 @@ it "creates a directory" do
10
10
  end
11
11
  ```
12
12
 
13
- The above test will break if `mkdir_p` is used instead.
13
+ The above test will break if `mkdir_p` is used instead.
14
14
  Refactoring code should not necessitate refactoring tests.
15
15
 
16
16
  A better approach is to use a temp directory if you are working with relative directories.
@@ -83,6 +83,7 @@ gem "fakefs", require: "fakefs/safe"
83
83
  RSpec
84
84
  -----
85
85
 
86
+
86
87
  Include FakeFS::SpecHelpers to turn FakeFS on and off in an example group:
87
88
 
88
89
  ``` ruby
@@ -95,6 +96,27 @@ end
95
96
 
96
97
  See `lib/fakefs/spec_helpers.rb` for more info.
97
98
 
99
+ FakeFs vs `pp` --- `TypeError: superclass mismatch for class File`
100
+ --------------
101
+
102
+ `pp` and `fakefs` collide, `require 'pp'` then `require 'fakefs'`.
103
+
104
+ Working with existing files
105
+ ---------------------------
106
+
107
+ Clone existing directories or files to reuse them during tests, they are safe to modify.
108
+
109
+ ```ruby
110
+ FakeFS do
111
+ config = File.expand_path('../../config', __FILE__)
112
+
113
+ FakeFS::FileSystem.clone(config)
114
+ expect(File.read("#{config}/foo.yml")).to include("original-content-of-foo")
115
+
116
+ File.write("#{config}/foo.yml"), "NEW")
117
+ expect(File.read("#{config}/foo.yml")).to eq "NEW"
118
+ end
119
+ ```
98
120
 
99
121
  Integrating with other filesystem libraries
100
122
  --------------------------------------------
@@ -112,7 +134,7 @@ FakeFS::File.class_eval do
112
134
  end
113
135
  ```
114
136
 
115
- How is this different than [MockFS](http://mockfs.rubyforge.org/) ?
137
+ [MockFS](http://mockfs.rubyforge.org/) comparison
116
138
  ----------------------------------
117
139
 
118
140
  FakeFS provides a test suite and works with symlinks. It's also strictly a
@@ -90,7 +90,7 @@ module FakeFS
90
90
  fail Errno::ENOENT, dir unless new_dir
91
91
 
92
92
  dir_levels.push dir unless blk
93
- blk.call if blk
93
+ blk.call(dir) if blk
94
94
  ensure
95
95
  dir_levels.pop if blk
96
96
  end
@@ -1,7 +1,7 @@
1
1
  module FakeFS
2
2
  # Version module
3
3
  module Version
4
- VERSION = '0.9.1'
4
+ VERSION = '0.9.2'
5
5
 
6
6
  def self.to_s
7
7
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakefs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-08-26 00:00:00.000000000 Z
15
+ date: 2016-10-04 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler
@@ -120,7 +120,7 @@ extensions: []
120
120
  extra_rdoc_files: []
121
121
  files:
122
122
  - LICENSE
123
- - README.markdown
123
+ - README.md
124
124
  - lib/fakefs.rb
125
125
  - lib/fakefs/base.rb
126
126
  - lib/fakefs/dir.rb