test_construct 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/CHANGELOG.md +4 -0
- data/LICENSE.txt +1 -1
- data/README.md +3 -1
- data/lib/test_construct/pathname_extensions.rb +2 -1
- data/lib/test_construct/version.rb +1 -1
- data/test/test_construct_test.rb +6 -7
- data/test/test_helper.rb +1 -1
- data/test_construct.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2cb744f55b899973f927f627cdd17e7bbad82d9edac86739488b74b6d6b74d8d
|
4
|
+
data.tar.gz: 1261326e23a686f3f6810bd0f018f05c601bef1a28d3d44b6864555ee612269c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9937c95edbde41d5b0ba19c59c375da21e47b8b903eb89c916ee568b734d2671b9c992e42f792ad644ee27b930cedf59da7836abfcd7be6b4bb78c3829bfd7df
|
7
|
+
data.tar.gz: 17d12e839988336a60aa1f377367d7cb2bafdea01181490ad8c5be3a78549db235165ec8a0ffbc8988304f5ac39b31efb58bb80deac93b1dcd7f95d18fc233db
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](https://badge.fury.io/rb/test_construct)
|
2
|
+
|
1
3
|
# TestConstruct
|
2
4
|
|
3
5
|
> "This is the construct. It's our loading program. We can load anything, from clothing to equipment, weapons, and training simulations, anything we need" -- Morpheus
|
@@ -126,7 +128,7 @@ If you disable, automatic chdir, note that your old assertions will not work:
|
|
126
128
|
```
|
127
129
|
within_construct(:chdir => false) do |construct|
|
128
130
|
construct.file("foo.txt")
|
129
|
-
# Fails. foo.txt was created in construct, but
|
131
|
+
# Fails. foo.txt was created in construct, but
|
130
132
|
# the current directory is not the construct!
|
131
133
|
assert File.exists?("foo.txt")
|
132
134
|
end
|
@@ -17,7 +17,8 @@ module TestConstruct
|
|
17
17
|
def file(filepath, contents = nil, &block)
|
18
18
|
path = (self+filepath)
|
19
19
|
path.dirname.mkpath
|
20
|
-
|
20
|
+
mode = RUBY_PLATFORM =~ /mingw|mswin/ ? 'wb:UTF-8' : 'w'
|
21
|
+
File.open(path, mode) do |f|
|
21
22
|
if(block)
|
22
23
|
if(block.arity==1)
|
23
24
|
block.call(f)
|
data/test/test_construct_test.rb
CHANGED
@@ -103,7 +103,7 @@ class TestConstructTest < Minitest::Test
|
|
103
103
|
test 'exists while in construct block' do
|
104
104
|
within_construct do |construct|
|
105
105
|
construct.file('foo.txt')
|
106
|
-
assert File.
|
106
|
+
assert File.exist?(construct + 'foo.txt')
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -112,7 +112,7 @@ class TestConstructTest < Minitest::Test
|
|
112
112
|
within_construct do |construct|
|
113
113
|
filepath = construct.file('foo.txt')
|
114
114
|
end
|
115
|
-
assert !File.
|
115
|
+
assert !File.exist?(filepath)
|
116
116
|
end
|
117
117
|
|
118
118
|
test 'has empty file contents by default' do
|
@@ -306,7 +306,6 @@ Contents
|
|
306
306
|
|
307
307
|
test 'overrides construct default' do
|
308
308
|
within_construct(:chdir => false) do |construct|
|
309
|
-
old_pwd = Dir.pwd
|
310
309
|
construct.directory('foo', :chdir => true) do |dir|
|
311
310
|
assert_equal dir.to_s, Dir.pwd
|
312
311
|
end
|
@@ -357,7 +356,7 @@ Contents
|
|
357
356
|
within_construct do |construct|
|
358
357
|
construct.directory('bar') do |dir|
|
359
358
|
dir.file('foo.txt')
|
360
|
-
assert File.
|
359
|
+
assert File.exist?('foo.txt')
|
361
360
|
end
|
362
361
|
end
|
363
362
|
end
|
@@ -418,7 +417,7 @@ Contents
|
|
418
417
|
test 'checking for a file is relative to container' do
|
419
418
|
within_construct do |construct|
|
420
419
|
construct.file('foo.txt')
|
421
|
-
assert File.
|
420
|
+
assert File.exist?('foo.txt')
|
422
421
|
end
|
423
422
|
end
|
424
423
|
|
@@ -518,7 +517,7 @@ Contents
|
|
518
517
|
rescue => e
|
519
518
|
error = e
|
520
519
|
end
|
521
|
-
assert_equal "bad stuff\nTestConstruct files kept at: #{path}",
|
520
|
+
assert_equal "bad stuff\nTestConstruct files kept at: #{path}", error.message
|
522
521
|
end
|
523
522
|
end
|
524
523
|
|
@@ -534,7 +533,7 @@ Contents
|
|
534
533
|
testing 'name option' do
|
535
534
|
test 'used in generation of the directory name' do
|
536
535
|
within_construct(name: "My best test ever!") do |container|
|
537
|
-
assert_match
|
536
|
+
assert_match(/my-best-test-ever-$/, container.basename.to_s)
|
538
537
|
end
|
539
538
|
end
|
540
539
|
end
|
data/test/test_helper.rb
CHANGED
@@ -14,7 +14,7 @@ class Minitest::Test
|
|
14
14
|
|
15
15
|
def self.test(name, &block)
|
16
16
|
name = name.strip.gsub(/\s\s+/, " ")
|
17
|
-
group = "#{@group}: " if @group
|
17
|
+
group = "#{@group}: " if defined? @group
|
18
18
|
test_name = "test_: #{group}#{name}".to_sym
|
19
19
|
defined = instance_methods.include? test_name
|
20
20
|
raise "#{test_name} is already defined in #{self}" if defined
|
data/test_construct.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["ben@bbrinck.com", "avdi@avdi.org"]
|
11
11
|
spec.description = %q{Creates temporary files and directories for testing.}
|
12
12
|
spec.summary = %q{Creates temporary files and directories for testing.}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/bhb/test_construct"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_construct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Brinckerhoff
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -106,7 +106,7 @@ files:
|
|
106
106
|
- test/test_construct_test.rb
|
107
107
|
- test/test_helper.rb
|
108
108
|
- test_construct.gemspec
|
109
|
-
homepage:
|
109
|
+
homepage: https://github.com/bhb/test_construct
|
110
110
|
licenses:
|
111
111
|
- MIT
|
112
112
|
metadata: {}
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.7.6
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: Creates temporary files and directories for testing.
|