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 +4 -4
- data/{README.markdown → README.md} +25 -3
- data/lib/fakefs/file_system.rb +1 -1
- data/lib/fakefs/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9f9df4a437b257a48a59a49e7a5c5a04ab1bbe6
|
4
|
+
data.tar.gz: ed42685cfdae7eebeafb2069e3055c298bd189c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf1309391825fafa8ae30e35a52e8703faa55531da6140b777cc10d3302e978a2e7643140cac02b278d5348114232d78429aaafa9bd542894781a2f8ad90c53c
|
7
|
+
data.tar.gz: cca5b5206a5d8c09bcbdab4d8a06a6510fb80c7aa6e2446c30169f0209e0a15c066060cb1e201d55054913e2e33866868ea4f013e062b4038fedcedd59044dc8
|
@@ -1,4 +1,4 @@
|
|
1
|
-
FakeFS [![build status](https://
|
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
|
-
|
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
|
data/lib/fakefs/file_system.rb
CHANGED
data/lib/fakefs/version.rb
CHANGED
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.
|
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-
|
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.
|
123
|
+
- README.md
|
124
124
|
- lib/fakefs.rb
|
125
125
|
- lib/fakefs/base.rb
|
126
126
|
- lib/fakefs/dir.rb
|