rspec_fixtures 0.1.1 → 0.1.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: 10bd5e5734989b5e04bc41f58da53463146aa207
4
- data.tar.gz: bc726892902db68c3bfbccabca2a5843ca5a1298
3
+ metadata.gz: f8f42a8219b659d746256423f6cef8343082f186
4
+ data.tar.gz: 0a67add3f6b129d72c7fcc9c942ab03dede22b7c
5
5
  SHA512:
6
- metadata.gz: e8e611e0ec6027541a68d1ad14d4bd2da3bc706835fc0db267d1758e34a32f385b4aa32e265786257652025e1aa4a0c2102e34ac135fb5558e923f23f48b49d4
7
- data.tar.gz: 30170aadfb66fea43f5e480e117faf0bbe0a5a6cc782de897e7df3c0c662b009280ced6fe4310d4e8709625ff00e7a061b791b7504ddae61a80cfda27a9fe8e9
6
+ metadata.gz: 3bcad4f7d615ebfef263489f2f96d6bd884b0676ddf7ae09afd2a817838ca6d883314efe36f7e459fc4ead8fb66c3113c717782ec599126a15f51f386f27765d
7
+ data.tar.gz: 071ad0e5be360ba9f8e73db2554755f4be4bf44a0240f22f8b64db0ef57f2ad34713121879adda8eba76fdb83a9f9e50a7e4c5bd9d1726aa44652b7cd0b7d9d1
@@ -1,5 +1,7 @@
1
1
  require 'rspec_fixtures/version'
2
2
 
3
+ require 'rspec_fixtures/extensions/file'
4
+
3
5
  require 'rspec_fixtures/stream_capturer'
4
6
  require 'rspec_fixtures/approval_handler'
5
7
  require 'rspec_fixtures/matchers/base'
@@ -22,7 +22,7 @@ module RSpecFixtures
22
22
 
23
23
  if user_approves?
24
24
  say "!txtgrn!Approved"
25
- File.write fixture_file, actual
25
+ File.deep_write fixture_file, actual
26
26
  true
27
27
  else
28
28
  say "!txtred!Not Approved"
@@ -0,0 +1,9 @@
1
+ require 'fileutils'
2
+
3
+ class File
4
+ def self.deep_write(file, content)
5
+ dir = File.dirname file
6
+ FileUtils.mkdir_p dir unless Dir.exist? dir
7
+ File.write file, content
8
+ end
9
+ end
@@ -45,9 +45,7 @@ module RSpecFixtures
45
45
  end
46
46
 
47
47
  def expected!
48
- Dir.mkdir fixtures_dir unless Dir.exist? fixtures_dir
49
- File.write fixture_file, nil unless File.exist? fixture_file
50
- File.read fixture_file
48
+ File.exist?(fixture_file) ? File.read(fixture_file) : ''
51
49
  end
52
50
  end
53
51
 
@@ -1,3 +1,3 @@
1
1
  module RSpecFixtures
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_fixtures
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
@@ -103,6 +103,7 @@ files:
103
103
  - README.md
104
104
  - lib/rspec_fixtures.rb
105
105
  - lib/rspec_fixtures/approval_handler.rb
106
+ - lib/rspec_fixtures/extensions/file.rb
106
107
  - lib/rspec_fixtures/matchers/base.rb
107
108
  - lib/rspec_fixtures/matchers/match_fixture.rb
108
109
  - lib/rspec_fixtures/matchers/output_fixture.rb