test_construct 2.0.1 → 2.0.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
- SHA1:
3
- metadata.gz: 2226dcdf6b97f267ca95e2bf15fcc02cb68b9948
4
- data.tar.gz: 40f781f1ad290caff5294dc87d08590f3785de97
2
+ SHA256:
3
+ metadata.gz: 2cb744f55b899973f927f627cdd17e7bbad82d9edac86739488b74b6d6b74d8d
4
+ data.tar.gz: 1261326e23a686f3f6810bd0f018f05c601bef1a28d3d44b6864555ee612269c
5
5
  SHA512:
6
- metadata.gz: b3c46e63982e31c3f56e88b9908471397d04a7427aeeb30e8fed05810b03ee0a41c1f00c79e98425a5fbe3c5a72de121f2fcfee915062ff79d90120d9dc5af66
7
- data.tar.gz: 4ef4c5a3a680b001e0dd29b73772538a6d2c1613ffcb4af0138d1bec0b67bd797535a9fb7415b23298adfff35d42c75b90b0d6f0e219e34d15aa7700fb5e3f35
6
+ metadata.gz: 9937c95edbde41d5b0ba19c59c375da21e47b8b903eb89c916ee568b734d2671b9c992e42f792ad644ee27b930cedf59da7836abfcd7be6b4bb78c3829bfd7df
7
+ data.tar.gz: 17d12e839988336a60aa1f377367d7cb2bafdea01181490ad8c5be3a78549db235165ec8a0ffbc8988304f5ac39b31efb58bb80deac93b1dcd7f95d18fc233db
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
+ .ruby-version
6
7
  Gemfile.lock
7
8
  InstalledFiles
8
9
  _yardoc
@@ -1,5 +1,9 @@
1
1
  # TestConstruct Changelog
2
2
 
3
+ ## v2.0.2
4
+
5
+ * Fixes line endings on Windows (@MSP-Greg)
6
+
3
7
  ## v2.0.1
4
8
 
5
9
  * Adds support for RSpec 3 (@jcouball)
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Ben Brinckerhoff
1
+ Copyright (c) 2013-2019 Ben Brinckerhoff
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/test_construct.svg)](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
- File.open(path,'w') do |f|
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)
@@ -1,3 +1,3 @@
1
1
  module TestConstruct
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
@@ -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.exists?(construct + 'foo.txt')
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.exists?(filepath)
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.exists?('foo.txt')
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.exists?('foo.txt')
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}", e.message
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 /my-best-test-ever-$/, container.basename.to_s
536
+ assert_match(/my-best-test-ever-$/, container.basename.to_s)
538
537
  end
539
538
  end
540
539
  end
@@ -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
@@ -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.1
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: 2015-02-25 00:00:00.000000000 Z
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.2.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.